Better handling of comments during formatting (#524)

This commit is contained in:
Karl Yngve Lervåg 2016-08-13 22:09:13 +02:00
parent c9141396bf
commit 83d32b4554

View File

@ -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)