Fix #559: Proper handling of ampersands
This commit is contained in:
parent
1e4f2f8e98
commit
0a22e6d46d
@ -44,7 +44,7 @@ function! VimtexIndent(lnum) " {{{1
|
||||
return indent(a:lnum)
|
||||
endif
|
||||
|
||||
let l:nprev = s:get_prev_line(l:nprev)
|
||||
let l:nprev = s:get_prev_line(l:nprev, 'ignore-ampersands')
|
||||
if l:nprev == 0 | return 0 | endif
|
||||
let l:prev = getline(l:nprev)
|
||||
|
||||
@ -56,12 +56,15 @@ function! VimtexIndent(lnum) " {{{1
|
||||
endfunction
|
||||
"}}}
|
||||
|
||||
function! s:get_prev_line(lnum) " {{{1
|
||||
function! s:get_prev_line(lnum, ...) " {{{1
|
||||
let l:ignore_amps = a:0 > 0
|
||||
let l:lnum = a:lnum
|
||||
let l:prev = getline(l:lnum)
|
||||
|
||||
while l:lnum != 0
|
||||
\ && (l:prev =~# '^\s*%' || s:is_verbatim(l:prev, l:lnum))
|
||||
\ && (l:prev =~# '^\s*%'
|
||||
\ || s:is_verbatim(l:prev, l:lnum)
|
||||
\ || !l:ignore_amps && match(l:prev, '^\s*&') >= 0)
|
||||
let l:lnum = prevnonblank(l:lnum - 1)
|
||||
let l:prev = getline(l:lnum)
|
||||
endwhile
|
||||
|
Loading…
Reference in New Issue
Block a user