Fix detecting jinja templates, #553

This commit is contained in:
Adam Stankiewicz
2020-09-23 23:25:01 +02:00
parent 3a298c9759
commit 7e2d060f88
4 changed files with 12 additions and 244 deletions

View File

@@ -370,6 +370,12 @@ func! polyglot#DetectHtmlFiletype()
if line =~# '^\(%\|<[%&].*>\)'
set ft=mason | return
endif
for lnum in range(1, min([line("$"), 50]))
let line = getline(lnum)
if line =~# '{{.*}}\|{%-\=\s*\(end.*\|extends\|block\|macro\|set\|if\|for\|include\|trans\)\(\<\|\>\)'
set ft=jinja.html | return
endif
endfor
set ft=html | return
endfunc