Use ==# instead of == (and similar)
This commit is contained in:
parent
b4fc6c53b1
commit
e290144c3a
@ -4,7 +4,7 @@
|
|||||||
" Email: karl.yngve@gmail.com
|
" Email: karl.yngve@gmail.com
|
||||||
"
|
"
|
||||||
|
|
||||||
if exists("b:did_indent")
|
if exists('b:did_indent')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let b:did_indent = 1
|
let b:did_indent = 1
|
||||||
@ -23,7 +23,7 @@ setlocal indentkeys+=[,(,{,),},],\&,=\\item
|
|||||||
function! s:vimtex_indent() " {{{1
|
function! s:vimtex_indent() " {{{1
|
||||||
" Find a non-blank non-comment line above the current line
|
" Find a non-blank non-comment line above the current line
|
||||||
let lnum = prevnonblank(v:lnum - 1)
|
let lnum = prevnonblank(v:lnum - 1)
|
||||||
while lnum != 0 && getline(lnum) =~ '^\s*%'
|
while lnum != 0 && getline(lnum) =~# '^\s*%'
|
||||||
let lnum = prevnonblank(lnum - 1)
|
let lnum = prevnonblank(lnum - 1)
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ function! s:vimtex_indent() " {{{1
|
|||||||
let pline = substitute(getline(lnum), '\\\@<!%.*', '', '')
|
let pline = substitute(getline(lnum), '\\\@<!%.*', '', '')
|
||||||
|
|
||||||
" Check for verbatim modes
|
" Check for verbatim modes
|
||||||
if synIDattr(synID(v:lnum, indent(v:lnum), 1), "name") == "texZone"
|
if synIDattr(synID(v:lnum, indent(v:lnum), 1), 'name') ==# 'texZone'
|
||||||
if empty(cline)
|
if empty(cline)
|
||||||
return indent(lnum)
|
return indent(lnum)
|
||||||
else
|
else
|
||||||
@ -46,12 +46,12 @@ function! s:vimtex_indent() " {{{1
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Align on ampersands
|
" Align on ampersands
|
||||||
if cline =~ '^\s*&' && pline =~ '\\\@<!&.*'
|
if cline =~# '^\s*&' && pline =~# '\\\@<!&.*'
|
||||||
return indent(v:lnum) + match(pline, '\\\@<!&') - stridx(cline, "&")
|
return indent(v:lnum) + match(pline, '\\\@<!&') - stridx(cline, '&')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Find previous non-empty non-comment non-ampersand line
|
" Find previous non-empty non-comment non-ampersand line
|
||||||
while lnum != 0 && (match(pline, '\\\@<!&') != -1 || pline =~ '^\s*%')
|
while lnum != 0 && (match(pline, '\\\@<!&') != -1 || pline =~# '^\s*%')
|
||||||
let lnum = prevnonblank(lnum - 1)
|
let lnum = prevnonblank(lnum - 1)
|
||||||
let pline = getline(lnum)
|
let pline = getline(lnum)
|
||||||
endwhile
|
endwhile
|
||||||
@ -62,14 +62,14 @@ function! s:vimtex_indent() " {{{1
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Use previous indentation for comments
|
" Use previous indentation for comments
|
||||||
if cline =~ '^\s*%'
|
if cline =~# '^\s*%'
|
||||||
return indent(v:lnum)
|
return indent(v:lnum)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let ind = indent(lnum)
|
let ind = indent(lnum)
|
||||||
|
|
||||||
" Add indent on begin environment
|
" Add indent on begin environment
|
||||||
if pline =~ '\\begin{.*}' && pline !~ s:envs_noindent
|
if pline =~# '\\begin{.*}' && pline !~ s:envs_noindent
|
||||||
let ind = ind + &sw
|
let ind = ind + &sw
|
||||||
|
|
||||||
" Add extra indent for list environments
|
" Add extra indent for list environments
|
||||||
@ -79,7 +79,7 @@ function! s:vimtex_indent() " {{{1
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Subtract indent on end environment
|
" Subtract indent on end environment
|
||||||
if cline =~ '\\end{.*}' && cline !~ s:envs_noindent
|
if cline =~# '\\end{.*}' && cline !~ s:envs_noindent
|
||||||
let ind = ind - &sw
|
let ind = ind - &sw
|
||||||
|
|
||||||
" Subtract extra indent for list environments
|
" Subtract extra indent for list environments
|
||||||
@ -96,10 +96,10 @@ function! s:vimtex_indent() " {{{1
|
|||||||
let ind += &sw*(max([popen - pclose, 0]) - max([cclose - copen, 0]))
|
let ind += &sw*(max([popen - pclose, 0]) - max([cclose - copen, 0]))
|
||||||
|
|
||||||
" Indent list items
|
" Indent list items
|
||||||
if pline =~ '^\s*\\\(bib\)\?item'
|
if pline =~# '^\s*\\\(bib\)\?item'
|
||||||
let ind += &sw
|
let ind += &sw
|
||||||
endif
|
endif
|
||||||
if cline =~ '^\s*\\\(bib\)\?item'
|
if cline =~# '^\s*\\\(bib\)\?item'
|
||||||
let ind -= &sw
|
let ind -= &sw
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ function! s:vimtex_indent() " {{{1
|
|||||||
let ind += &sw
|
let ind += &sw
|
||||||
let s:tikz_indented += 1
|
let s:tikz_indented += 1
|
||||||
endif
|
endif
|
||||||
if s:tikz_indented > 0 && pline =~ ';\s*$'
|
if s:tikz_indented > 0 && pline =~# ';\s*$'
|
||||||
let ind -= &sw
|
let ind -= &sw
|
||||||
let s:tikz_indented -= 1
|
let s:tikz_indented -= 1
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user