diff options
author | Yaroslav <contact@yaroslavps.com> | 2020-03-28 00:57:27 +0300 |
---|---|---|
committer | Yaroslav <contact@yaroslavps.com> | 2020-03-28 00:57:27 +0300 |
commit | 9a3aa7b20a67c1b7991da1da9508ad5f78f76352 (patch) | |
tree | e3e797dd0d0f3fefe86b25c80177a0cbcc3b98af /dotfiles/.vim/ftdetect/jinja.vim | |
parent | 2a934f9718516762085b010112850aa2208570cb (diff) | |
download | vimrice-9a3aa7b20a67c1b7991da1da9508ad5f78f76352.tar.gz vimrice-9a3aa7b20a67c1b7991da1da9508ad5f78f76352.zip |
proper jinja indentation and file detection
Diffstat (limited to 'dotfiles/.vim/ftdetect/jinja.vim')
-rw-r--r-- | dotfiles/.vim/ftdetect/jinja.vim | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/dotfiles/.vim/ftdetect/jinja.vim b/dotfiles/.vim/ftdetect/jinja.vim new file mode 100644 index 0000000..d700140 --- /dev/null +++ b/dotfiles/.vim/ftdetect/jinja.vim @@ -0,0 +1,14 @@ +" Figure out which type of hilighting to use for html. +fun! s:SelectHTML() + let n = 1 + while n < 50 && n <= line("$") + " check for jinja + if getline(n) =~ '{{.*}}\|{%-\?\s*\(end.*\|extends\|block\|macro\|set\|if\|for\|include\|trans\)\>' + set ft=jinja.html + return + endif + let n = n + 1 + endwhile +endfun +autocmd BufNewFile,BufRead *.html,*.htm call s:SelectHTML() +autocmd BufNewFile,BufRead *.jinja2,*.j2,*.jinja,*.nunjucks,*.nunjs,*.njk set ft=jinja |