From 7e2d060f880a2d1d8e4742e27709869425983335 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Wed, 23 Sep 2020 23:25:01 +0200 Subject: Fix detecting jinja templates, #553 --- autoload/polyglot.vim | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'autoload/polyglot.vim') diff --git a/autoload/polyglot.vim b/autoload/polyglot.vim index b7113f31..325287fc 100644 --- a/autoload/polyglot.vim +++ b/autoload/polyglot.vim @@ -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 -- cgit v1.2.3