diff options
Diffstat (limited to 'syntax/jinja2.vim')
-rw-r--r-- | syntax/jinja2.vim | 58 |
1 files changed, 10 insertions, 48 deletions
diff --git a/syntax/jinja2.vim b/syntax/jinja2.vim index 3ddea85c..55d9fbfd 100644 --- a/syntax/jinja2.vim +++ b/syntax/jinja2.vim @@ -1,44 +1,17 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1 " Vim syntax file -" Language: Jinja template -" Maintainer: Armin Ronacher <armin.ronacher@active-4.com> -" Last Change: 2008 May 9 -" Version: 1.1 -" -" Known Bugs: -" because of odd limitations dicts and the modulo operator -" appear wrong in the template. -" -" Changes: -" -" 2008 May 9: Added support for Jinja2 changes (new keyword rules) - -" .vimrc variable to disable html highlighting -if !exists('g:jinja_syntax_html') - let g:jinja_syntax_html=1 -endif +" Language: Jinja2 - with special modifications for compound-filetype +" compatibility +" Maintainer: Dave Honneffer <pearofducks@gmail.com> +" Last Change: 2018.02.11 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded if !exists("main_syntax") - if version < 600 - syntax clear - elseif exists("b:current_syntax") - finish -endif - let main_syntax = 'jinja' + let main_syntax = 'jinja2' endif -" Pull in the HTML syntax. -if g:jinja_syntax_html - if version < 600 - so <sfile>:p:h/html.vim - else - runtime! syntax/html.vim - unlet b:current_syntax - endif -endif +let b:current_syntax = '' +unlet b:current_syntax syntax case match @@ -95,15 +68,8 @@ syn match jinjaStatement containedin=jinjaTagBlock contained /\<with\(out\)\?\s\ " Define the default highlighting. -" For version 5.7 and earlier: only when not done already -" For version 5.8 and later: only when an item doesn't have highlighting yet -if version >= 508 || !exists("did_jinja_syn_inits") - if version < 508 - let did_jinja_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif +if !exists("did_jinja_syn_inits") + command -nargs=+ HiLink hi def link <args> HiLink jinjaPunctuation jinjaOperator HiLink jinjaAttribute jinjaVariable @@ -130,10 +96,6 @@ if version >= 508 || !exists("did_jinja_syn_inits") delcommand HiLink endif -let b:current_syntax = "jinja" - -if main_syntax == 'jinja' - unlet main_syntax -endif +let b:current_syntax = "jinja2" endif |