Better handling of comments during formatting (#524)
This commit is contained in:
parent
c9141396bf
commit
83d32b4554
@ -17,8 +17,7 @@ function! vimtex#format#init_script() " {{{1
|
|||||||
\ '%(\\\[|\$\$)\s*$',
|
\ '%(\\\[|\$\$)\s*$',
|
||||||
\], '|') . ')'
|
\], '|') . ')'
|
||||||
|
|
||||||
let s:border_end = '\v[^\\]\%'
|
let s:border_end = '\\%(' . join([
|
||||||
\ . '|\\%(' . join([
|
|
||||||
\ '\\\*?',
|
\ '\\\*?',
|
||||||
\ 'clear%(double)?page',
|
\ 'clear%(double)?page',
|
||||||
\ 'linebreak',
|
\ 'linebreak',
|
||||||
@ -102,6 +101,12 @@ function! s:format(top, bottom) " {{{1
|
|||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Skip all lines with comments
|
||||||
|
if l:line =~# '\v%(^|[^\\])\%'
|
||||||
|
let l:mark = l:current - 1
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
if l:line =~# s:border_end
|
if l:line =~# s:border_end
|
||||||
if l:current < l:mark
|
if l:current < l:mark
|
||||||
let l:bottom += s:format_build_lines(l:current+1, l:mark)
|
let l:bottom += s:format_build_lines(l:current+1, l:mark)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user