diff --git a/autoload/vimtex/format.vim b/autoload/vimtex/format.vim index ee5bf5c..a96a983 100644 --- a/autoload/vimtex/format.vim +++ b/autoload/vimtex/format.vim @@ -17,7 +17,7 @@ function! vimtex#format#init_script() " {{{1 \ '%(\\\[|\$\$)\s*$', \], '|') . ')' - let s:border_end = '\\%(' . join([ + let s:border_end = '\v\\%(' . join([ \ '\\\*?', \ 'clear%(double)?page', \ 'linebreak', @@ -103,6 +103,9 @@ function! s:format(top, bottom) " {{{1 " Skip all lines with comments if l:line =~# '\v%(^|[^\\])\%' + if l:current < l:mark + let l:bottom += s:format_build_lines(l:current+1, l:mark) + endif let l:mark = l:current - 1 continue endif diff --git a/test/vader/format.vader b/test/vader/format.vader index caf0b0a..bdd85bc 100644 --- a/test/vader/format.vader +++ b/test/vader/format.vader @@ -84,7 +84,8 @@ Expect tex (Verify): nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea \\ rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - \item ipsum dolor sit amet. start a new paragraph % test + \item ipsum dolor sit amet. + start a new paragraph % test Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet