aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.vim/ftdetect/jinja.vim
blob: d7001409ae4a91a3781a7361ef3b6ffee70a1727 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
" 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*\(end.*\|extends\|block\|macro\|set\|if\|for\|include\|trans\)\>'
      set ft=jinja.html
      return
    endif
    let n = n + 1
  endwhile
endfun
autocmd BufNewFile,BufRead *.html,*.htm call s:SelectHTML()
autocmd BufNewFile,BufRead *.jinja2,*.j2,*.jinja,*.nunjucks,*.nunjs,*.njk set ft=jinja