Loading autoload/jinja.vim +6 −6 Original line number Diff line number Diff line " Author: Alejandro "HiPhish" Sanchez " License: The MIT License {{{ " Copyright © 2016 Alejandro "HiPhish" Sanchez " Copyright (c) 2016 Alejandro "HiPhish" Sanchez " " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the "Software"), Loading Loading @@ -31,7 +31,7 @@ " The parameters will get adjusted to account for files which are too small. " This is because the function might get called by scripts that just assume a " certain minimal length. function! jinja#DetectJinja(first, last) function! jinja#DetectJinja(first, last) abort " How many lines to count, range takes precedence over default values let l:first = min([a:first, line('$')]) let l:last = min([a:last, line('$')]) Loading @@ -45,9 +45,9 @@ function! jinja#DetectJinja(first, last) \'^\#\s*(extends|block|macro|set|if|for|include|trans)>|' . \'^\#\#.+' " Probe a number of lines for Jinja code, give up if none is found. for l in range(l:first, l:last) if getline(l) =~? l:jinja_pattern return l for l:line in range(l:first, l:last) if getline(l:line) =~? l:jinja_pattern return l:line endif endfor endfun Loading @@ -55,7 +55,7 @@ endfun " Appends '.jinja' to the 'filetype' option if Jinja code has been detected in " the buffer. function! jinja#AdjustFiletype() function! jinja#AdjustFiletype() abort if &filetype =~? 'jinja' return endif Loading ftdetect/jinja.vim +4 −2 Original line number Diff line number Diff line " Author: Alejandro "HiPhish" Sanchez " License: The MIT License {{{ " Copyright © 2016 Alejandro "HiPhish" Sanchez " Copyright (c) 2016 Alejandro "HiPhish" Sanchez " " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the "Software"), Loading @@ -22,6 +22,8 @@ " }}} " This is flawed: if the file name is 'foo.jinja' it will work fine, but if " the file name is 'foo.html.jinja' we would want the file type to be " 'html.jinja' instead of just 'jinja'. However, we cannot simply take Loading @@ -45,7 +47,7 @@ function! s:DetectFileExtension(fname) if empty(&filetype) set filetype=jinja " execute 'setfiletype jinja' elseif &ft =~? 'jinja' elseif &filetype =~? 'jinja' return else set filetype+=.jinja Loading syntax/jinja.vim +2 −2 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ syntax case match if exists("b:current_syntax") && b:current_syntax =~ 'jinja' if exists('b:current_syntax') && b:current_syntax =~? 'jinja' finish endif Loading Loading @@ -87,4 +87,4 @@ HiLink jinjaComment Comment delcommand HiLink let b:current_syntax = "jinja" let b:current_syntax = 'jinja' Loading
autoload/jinja.vim +6 −6 Original line number Diff line number Diff line " Author: Alejandro "HiPhish" Sanchez " License: The MIT License {{{ " Copyright © 2016 Alejandro "HiPhish" Sanchez " Copyright (c) 2016 Alejandro "HiPhish" Sanchez " " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the "Software"), Loading Loading @@ -31,7 +31,7 @@ " The parameters will get adjusted to account for files which are too small. " This is because the function might get called by scripts that just assume a " certain minimal length. function! jinja#DetectJinja(first, last) function! jinja#DetectJinja(first, last) abort " How many lines to count, range takes precedence over default values let l:first = min([a:first, line('$')]) let l:last = min([a:last, line('$')]) Loading @@ -45,9 +45,9 @@ function! jinja#DetectJinja(first, last) \'^\#\s*(extends|block|macro|set|if|for|include|trans)>|' . \'^\#\#.+' " Probe a number of lines for Jinja code, give up if none is found. for l in range(l:first, l:last) if getline(l) =~? l:jinja_pattern return l for l:line in range(l:first, l:last) if getline(l:line) =~? l:jinja_pattern return l:line endif endfor endfun Loading @@ -55,7 +55,7 @@ endfun " Appends '.jinja' to the 'filetype' option if Jinja code has been detected in " the buffer. function! jinja#AdjustFiletype() function! jinja#AdjustFiletype() abort if &filetype =~? 'jinja' return endif Loading
ftdetect/jinja.vim +4 −2 Original line number Diff line number Diff line " Author: Alejandro "HiPhish" Sanchez " License: The MIT License {{{ " Copyright © 2016 Alejandro "HiPhish" Sanchez " Copyright (c) 2016 Alejandro "HiPhish" Sanchez " " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the "Software"), Loading @@ -22,6 +22,8 @@ " }}} " This is flawed: if the file name is 'foo.jinja' it will work fine, but if " the file name is 'foo.html.jinja' we would want the file type to be " 'html.jinja' instead of just 'jinja'. However, we cannot simply take Loading @@ -45,7 +47,7 @@ function! s:DetectFileExtension(fname) if empty(&filetype) set filetype=jinja " execute 'setfiletype jinja' elseif &ft =~? 'jinja' elseif &filetype =~? 'jinja' return else set filetype+=.jinja Loading
syntax/jinja.vim +2 −2 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ syntax case match if exists("b:current_syntax") && b:current_syntax =~ 'jinja' if exists('b:current_syntax') && b:current_syntax =~? 'jinja' finish endif Loading Loading @@ -87,4 +87,4 @@ HiLink jinjaComment Comment delcommand HiLink let b:current_syntax = "jinja" let b:current_syntax = 'jinja'