Giter VIP home page Giter VIP logo

django-plus.vim's Introduction

Neal Joslin

Software Developer located in Michigan. In search of tidbits and new knowledge.

Currently

Moving from Vim to Neovim and Lua

Working a lot with Typescript React Native Tailwind CSS Firebase

Making my life easier with Home Assistant

Tinkering with Workspace Specs


Technology

Python Django DjangoREST

Javascript Typescript jQuery React React Native

HTML5 CSS3 Bootstrap

Ruby Rails

PHP C C++

Postgres MariaDB MySQL

Virtualbox Vagrant Docker

django-plus.vim's People

django-plus.vim's Issues

Add extra settings

Add extra options to disable Django Syntax, Python & DjangoHTML independently. (Clashes with my existing color scheme)

Add option to use Sys calls instead of pydo's


Already done, but will make it a separate branch

Exclude Quickfix

Fixes conflict specifically with vim-qf's QuickFix functions. QuickFix, in general, should be skipped with this function
Issue could effect other Plugins in similar situations, but this commit only solves QuickFix.

Specs:

  • Vim: Vim 9 (64bit)
  • OS: Windows 10 & Pop!_OS/Ubuntu

How to recreate

  • Install both vim-qf & django-plug
  • Goto any Django Project's view.py
  • :copen + :cclose + :copen + :cclose
    • Open/Close 2 or more times

Result:

Error detected while processing FileType Autocommands for "*"..function <SNR>7_LoadFTPlugin
  • Note: {x}_LoadFTPlugin x changes based on whatever pid vim{v}\ftplugin.vim is in :scriptnames
  • Offending command in ftplugin.vim is: legacy exe b:undo_ftplugin

With tinkering, using :make, the error message [below] also shows up

Error detected while processig QuickFixCmdPost Autocommands for "make"..function qf#OpenQuickfix[17]..fileFileType Autocommands for "*"..function <SNR>6_LoadFTPlugin:
Line: 3:
E184: No such user-defined command: Filter

Theory:

# :help undo_ftplugin 
When the user does ":setfiletype xyz" the effect of the previous filetype
should be undone.

When setting the filetype of QuickFix to qf again, it undoes all vim-qf's functions which causes vim-qf to crash.
Seeing most Plugins are designed to define functions one time, Django-Plus should avoid inadvertently removing them; especially with QuickFix which is a special case


Notes of behavior

function! djangoplus#detect#filetype(filename) abort

  " Passed with: djangoplus#detect#filetype(expand('<afile>:p')
  echom 'filename ' . a:filename

  " expanded inside the function
  echom 'expand path ' . expand('%:p')

  " filetype Output 
  echom 'filetype &l ' . &l:filetype

  " ... more stuff

endfunction
1) Opening views.py
filename            /path/to/project/app1/views.py
expand path         /path/to/project/app1/views.py
filetype &l         
2) Opening QuickFix
filename            /path/to/project/quickfix
expand path         
filetype &l         qf

Point:

This illustrates why the original empty(a:filename) isn't catching the QuickFix.

Fix Template Search Lag

Vim's pydo/py3do functions run the template finder function 3020 times, freezing up vim for ~10 seconds.
py / py3 commands only run it once and freeze vim for < ~1 second
Note: This is problem is only for the initial search, but 10 seconds is a long wait.

Specs:

  • Vim: Vim 9 (64bit)
    • Python2 & Python3 versions tested
  • OS: Windows 10 & Pop!_OS/Ubuntu

Illustrating the Issue

add Func to django-plus.vim/bin/template_finder.py
def record_start():
    from datetime import datetime
    logger = open('/path/to/my/plugins/django-plus.vim/start_times.txt', 'a')
    logger.write('{0}\n'.format(datetime.now()))
    logger.close()

def djangoplus_find_templates(cwd, app_paths, cmdline=False):
    record_start()

    # do the normal stuff
  1. Goto a view's reverse function
  2. ci' or ci"
  3. Type something
  4. Check file

Already fixed with 421aff7

As the original repo is very cold and I don't want to spam pull requests

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.