A collection of Django niceties for Neovim. (Mostly based off of django-extensions.)
It currently offers following functionalities:
showViewURLS- A Flask like view of your views where the URLs corresponding to a view are shown on the side of the view. Only supports class based views for now. Example:
class ForumList(...) /forums/
... ^^^^^^^^
...Install using your favorite plugin manager.
For example, if you use vim-plug, put:
Plug 'pulsar17/djist'
in your vimrc, then :PlugInstall the plugin.
The DJANGO_SETTINGS_MODULE environment variable must be set to the correct settings module before running this plugin. This can be done by setting it while launching Neovim as follows:
$ DJANGO_SETTINGS_MODULE='<myproject>.settings' nvimNote: Neovim must be started at the project root, as djist adds the current working directory to Python's sys.path so the settings module can be imported. Starting the editor at the project root is a good practice anyways.
Go anywhere inside the view and run :lua require'djist'.showViewURLS()
djistfirst parses the current buffer and extracts the name of the view usingtreesitter.- After that
djistdetects the current virtual environment(using theVIRTUAL_ENVenvironment variable). - Then it launches the venv's Python interpreter with a script and provides the
viewNameas one of the arguments. - The script then finds the corresponding URLs for the view and prints them on its stdout which is monitored by
djist(stdout is actually created and passed to the Python process bydjist) - The launching of Python and monitoring of stdout is asynchronous, thanks to
luvit(libuvbindings for Lua) provided by Neovim.

