Skip to main content

Command Palette

Search for a command to run...

Use vim-projectionist to jump around in django projects

Published
1 min read

When working on django projects, I need to switching among django’s model, view, url, admin and serializers files. I used to use fzf.vim to jump around until I found vim-projectionist.

With this plugin, you can create a “map” of your source code, with this map, you can just from for example, .c file to .h file.

Create a .projections.json under your django file as follows:

{
    "*/urls.py": { "type": "urls", "alternate": "{}/views.py" },
    "*/models.py": { "type": "models" },
    "*/serializers.py": { "type": "serializers" },
    "*/admin.py": { "type": "admin" },
    "*/views.py": { "type": "view" }
}

Now I have these command to jump around:

  • When I open urls.py, press :A will jump to the alternate file views.py
  • :Eurls app_name to open urls.py of an app
  • :Emodels app_name to open models.py
  • :Eserializers app_name to open serializers.py
  • :Eadmin app_name to open admin.py
  • :Eviews app_name to open views.py

The plugin also supports auto complete so you don't need to input too many characters.

75 views