Commit 5f765fef authored by HiPhish's avatar HiPhish
Browse files

Satisfy 'vint' linter complaints

parent a6d2cd50
Loading
Loading
Loading
Loading
+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"),
@@ -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('$')])
@@ -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
@@ -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
+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"),
@@ -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
@@ -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
+2 −2
Original line number Diff line number Diff line
@@ -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

@@ -87,4 +87,4 @@ HiLink jinjaComment Comment

delcommand HiLink

let b:current_syntax = "jinja"
let b:current_syntax = 'jinja'