mirror of
https://github.com/lepture/vim-jinja.git
synced 2025-11-08 11:23:50 -05:00
Add nunjucks support (#8)
This commit is contained in:
committed by
Hsiaoming Yang
parent
4412484b41
commit
11e769cc2d
@@ -1,14 +1,14 @@
|
|||||||
" Figure out which type of hilighting to use for html.
|
" Figure out which type of hilighting to use for html.
|
||||||
fun! s:SelectHTML()
|
fun! s:SelectHTML()
|
||||||
let n = 1
|
let n = 1
|
||||||
while n < 50 && n < line("$")
|
while n < 50 && n <= line("$")
|
||||||
" check for jinja
|
" check for jinja
|
||||||
if getline(n) =~ '{%\s*\(extends\|block\|macro\|set\|if\|for\|include\|trans\)\>'
|
if getline(n) =~ '{{.*}}\|{%-\?\s*\(end.*\|extends\|block\|macro\|set\|if\|for\|include\|trans\)\>'
|
||||||
set ft=jinja
|
set ft=jinja.html
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let n = n + 1
|
let n = n + 1
|
||||||
endwhile
|
endwhile
|
||||||
endfun
|
endfun
|
||||||
autocmd BufNewFile,BufRead *.html,*.htm call s:SelectHTML()
|
autocmd BufNewFile,BufRead *.html,*.htm,*.nunjucks,*.nunjs,*.njk call s:SelectHTML()
|
||||||
autocmd BufNewFile,BufRead *.j2,*.jinja2,*.jinja set ft=jinja
|
autocmd BufNewFile,BufRead *.jinja2,*.j2,*.jinja set ft=jinja
|
||||||
|
|||||||
Reference in New Issue
Block a user