mirror of
https://github.com/lepture/vim-jinja.git
synced 2025-11-13 05:43:50 -05:00
improve ftdetect. #2
This commit is contained in:
@@ -1 +1,13 @@
|
||||
au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm if &ft == 'htmldjango' | set ft=jinja | endif
|
||||
" 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*\(extends\|block\|macro\|set\|if\|for\|include\|trans\)\>'
|
||||
set ft=jinja
|
||||
return
|
||||
endif
|
||||
let n = n + 1
|
||||
endwhile
|
||||
endfun
|
||||
autocmd BufNewFile,BufRead *.jinja2,*.jinja,*.html,*.htm call s:SelectHTML()
|
||||
|
||||
Reference in New Issue
Block a user