• Stars
    star
    178
  • Rank 214,989 (Top 5 %)
  • Language
    Vim Script
  • License
    MIT License
  • Created over 8 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🎸 Improvements to the handling of Django related files in Vim

django-plus.vim


Improvements to the handling of Django related files in Vim, some of which are based on Steve Losh's htmldjango scripts.

Why?

Django support in Vim sucks.

What Sucks? Sucks?
Hard-coded htmldjango filetype for any .html file Yes
HTML indentation Yes
QuerySet completions Yes
settings.py variable completions Yes
Template tag and filter completions Yes
Template file completion for {% include %} and {% extends %} Yes
Template file completion for rendering functions Yes

To help you understand the difference this plugin makes, I used science:

science

As you can see, one line goes up. However, the other line doesn't go up that much. It doesn't get any clearer than that.

Improvements

A summary of improvements to Django development in Vim.

General

  • Django is detected by searching parent directories for clues that indicate the current file is within a Django project.
  • b:is_django is set in any file that's within a Django project. This could be useful for your personal scripts.
  • b:is_django_settings is set if the file is settings.py or if the file is in the same directory as settings.py. (b:is_django will still be set)
  • Optionally append .django to the filetype for files found within a Django project.
  • If a Django project's manage.py script is found, completions will include your settings and templatetags found in INSTALLED_APPS.
  • g:django_filetypes takes a list of glob patterns to append the django filetype to matching files. e.g. *.xml will have the filetype xml.django if the file is found in a Django project.

Python

  • Completions for Django settings when b:is_django_settings is present.
  • Completions for settings. when b:is_django is present in a .py file.
  • Completions for template files when using render(), get_template(), render_to_string(), render_to_response(), or template_name =.
  • QuerySets could be lurking anywhere. That's why QuerySet completions will be included for basically anything after a period.
  • If you are using Ultisnips, Django snippets are enabled and UltiSnips#FileTypeChanged() is called to ensure that :UltiSnipsEdit opens django.snippets by default instead of python.snippets.

HTML

  • The filetype is set to htmldjango when editing HTML files.
  • Basic completions for template tags and filters.
  • Completions for template files when using {% extends %} or {% include %}.
  • Django tags are indented correctly, including custom tags.
  • matchit configuration for Django tags, including custom tags. Additionally, the cursor is placed at the beginning of the tag name.
  • Tag and variable blocks are highlighted within script tags, style tags, and HTML attributes.
  • If you are using Ultisnips, HTML snippets are enabled and UltiSnips#FileTypeChanged() is called to ensure that :UltiSnipsEdit opens htmldjango.snippets by default instead of html.snippets.

More Repositories

1

tmux2html

🐈 Render full tmux windows or individual panes as HTML
Python
692
star
2

braceless.vim

🐍 Text objects, folding, and more for Python and other indented languages.
Vim Script
392
star
3

startuptime.vim

Breakdown Vim's --startuptime output
Vim Script
284
star
4

helpful.vim

📓 Display vim version numbers in docs
Vim Script
177
star
5

nmux

A multiplexer for Neovim processes
Objective-C
110
star
6

fzf-filemru

File MRU with fzf.vim
Shell
91
star
7

deoplete-clang2

Python
90
star
8

moult

A utility for finding Python packages that may not be in use.
Python
50
star
9

nvim-python-doctor

🚑 Display diagnostic information about Python installations for Neovim
Shell
45
star
10

impsort.vim

Sort and highlight Python imports in Vim
Vim Script
36
star
11

local-indent.vim

Display a guide for the current line's indent level.
Vim Script
32
star
12

hammerspoon-vimouse

Control the mouse with Hammerspoon in a Vim-ish way
Lua
28
star
13

Developer-Profile

A Google Chrome extension that deletes browser data when all windows in a profile are closed.
HTML
25
star
14

exception.vim

Vim plugin for tracing exceptions thrown by VimL scripts.
Vim Script
24
star
15

gofmt.vim

A Vim plugin that runs gofmt when you save
Vim Script
19
star
16

dootfiles

🎵 dootfiles beep boop deet doot 🎵
Vim Script
18
star
17

spellrotate.vim

Cycles spelling suggestions under the cursor
Vim Script
17
star
18

wstrip.vim

Strip trailing whitespace only on changed lines
Vim Script
16
star
19

nvim-api-viewer

Display Neovim API functions in a buffer for reference.
Vim Script
14
star
20

sshclip

Sever/client clipboard over SSH for Neovim
Shell
13
star
21

dyslexic.vim

😭 Find mistyped text by searching for word permutations
Vim Script
13
star
22

haunted.vim

👻 Scripted automation in Vim using ghosts
Vim Script
13
star
23

osx-autoclean

🗑️ Automatic Directory Cleaning on macOS
Shell
12
star
24

auto_rsync

Automatically rsync a directory watched by fswatch
Shell
11
star
25

anyline.vim

🚥 A highly customizable statusline for Vim
Vim Script
11
star
26

colorpal.vim

Vim theming plugin
Vim Script
10
star
27

hl-goimport.vim

Highlights imported packages in Go
Vim Script
9
star
28

gitbusy.vim

🐝 Stash your Vim session using `git stash` before switching to another branch.
Vim Script
6
star
29

headlines.vim

📰 Quickly edit the top of your source files
Vim Script
5
star
30

luser

Drop-in replacement for os/user in Go
Go
5
star
31

ubuntu-vims

Docker container for builds of Vim from different versions of Ubuntu
5
star
32

nanofish

oh-my-zsh theme
3
star
33

deoplete-server

[WIP] Deoplete server
3
star
34

nvim-checkhealth

:CheckHealth command for older Neovim versions
Vim Script
2
star
35

wstrip-changed.vim

Strip trailing whitespace only on changed lines.
Vim Script
2
star
36

pdfpop

A very simple macOS command line utility for creating PDFs from an existing PDF
Objective-C
2
star
37

zsh-duckduckgo

Get very simple responses from DuckDuckGo in your z-shell
Shell
1
star
38

django-userjs

userjs is a Django application that produces javascript that represents a User object.
Python
1
star
39

shellcolors

Utility for displaying shell colors and finding a close match
Python
1
star