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*$',
|
||||
\], '|') . ')'
|
||||
|
||||
let s:border_end = '\v[^\\]\%'
|
||||
\ . '|\\%(' . join([
|
||||
let s:border_end = '\\%(' . join([
|
||||
\ '\\\*?',
|
||||
\ 'clear%(double)?page',
|
||||
\ 'linebreak',
|
||||
@ -102,6 +101,12 @@ function! s:format(top, bottom) " {{{1
|
||||
continue
|
||||
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:current < l:mark
|
||||
let l:bottom += s:format_build_lines(l:current+1, l:mark)
|
||||
|
Loading…
x
Reference in New Issue
Block a user