Permalink
Browse files

Fixed some detection bugs

  • Loading branch information...
1 parent 5d49cef commit 8a8f0ed97c1751d304cf5b7241f2fe27b0e61f81 @mitsuhiko committed Sep 17, 2013
Showing with 3 additions and 2 deletions.
  1. +3 −2 plugin/htmljinja.vim
@@ -25,7 +25,8 @@ fun! s:TryDetectJinja()
let n = 1
while n < 50 && n < line("$")
- if getline(n) =~ '{%\s*\(extends\|block\|macro\|set\|if\|for\|include\|trans\)\>'
+ let line = getline(n)
+ if line =~ '{%\s*\(extends\|block\|macro\|set\|if\|for\|include\|trans\)\>' || line =~ '{{\s*\S+[|(]'
setlocal filetype=htmljinja
return
endif
@@ -56,7 +57,7 @@ endfun
fun! s:ConsiderSwitchingToJinjaAgain()
unlet b:did_jinja_autodetect
- call s:ConsiderSwitchingToJinja()
+ call s:TryDetectJinja()
endfun
autocmd FileType htmldjango call s:ConsiderSwitchingToJinja()

0 comments on commit 8a8f0ed

Please sign in to comment.