improve ftdetect. #2

This commit is contained in:
Hsiaoming Yang
2013-01-27 02:18:50 +08:00
parent 365ba14094
commit c0d7521a50

View File

@@ -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()