diff options
| author | Adam Stankiewicz <sheerun@sher.pl> | 2015-12-06 11:39:05 +0100 | 
|---|---|---|
| committer | Adam Stankiewicz <sheerun@sher.pl> | 2015-12-06 11:39:05 +0100 | 
| commit | 0dc7696c89516332ae577e40c898f8a1d1afb71d (patch) | |
| tree | cb3c524c57f7b7b8661d22fb65e618d6e6286f37 /ftdetect | |
| parent | 5658b62b7afb7d4855e2634d8d067cbdf1d332c9 (diff) | |
| download | vim-polyglot-0dc7696c89516332ae577e40c898f8a1d1afb71d.tar.gz vim-polyglot-0dc7696c89516332ae577e40c898f8a1d1afb71d.zip | |
Add jinja language support, closes #92
Diffstat (limited to 'ftdetect')
| -rw-r--r-- | ftdetect/polyglot.vim | 16 | 
1 files changed, 16 insertions, 0 deletions
| diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 6869abf5..12440d61 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -162,6 +162,22 @@ autocmd BufNewFile,BufRead *.jsx set filetype=javascript.jsx  autocmd BufNewFile,BufRead *.js    \ if <SID>EnableJSX() | set filetype=javascript.jsx | endif  endif +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jinja') == -1 +   +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 +      return +    endif +    let n = n + 1 +  endwhile +endfun +autocmd BufNewFile,BufRead *.html,*.htm,*.nunjucks,*.nunjs  call s:SelectHTML() +autocmd BufNewFile,BufRead *.jinja2,*.j2,*.jinja set ft=jinja +endif  if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'json') == -1  autocmd BufNewFile,BufRead *.json set filetype=json | 
