Skip to content

Commit

Permalink
Tweak in \if...\fi indentation
Browse files Browse the repository at this point in the history
Now, lines like
\ifbaarfoo\foo\baz\fi
do not cause additional indentation on the next line.
  • Loading branch information
gerw committed Feb 5, 2017
1 parent 3f8987e commit 799d162
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions indent/tex.vim
Expand Up @@ -248,10 +248,16 @@ function! s:AssemblePatterns()

if g:tex_indent_ifelsefi
" Do match '\if..' only if it is not followed by '{'
" Require \fi, and \if... only at beginning of line
" Require \fi, and \if... only at beginning of line,
" otherwise,
" \newif\ifbarfoo
" would be indented.
" Expection: If a line starts with '\if...' and
" contains an '\fi', it is not indented, e.g.:
" \ifbarfoo\foobaz\fi
" Exception: '\expandafter\ifx\csname barfoo \endcsname'
" is quite common and indented.
let open .= '\|^\s*\%(\\expandafter\)\?\\if\a*\>{\@!'
" is quite common and indented.
let open .= '\|^\s*\%(\\expandafter\)\?\\if\a*\>{\@!\%(.*\\fi\)\@!'
let close .= '\|^\s*\\fi\>'
let elseor = '\\else\>\|\\or\>'
if hanging != ''
Expand Down

0 comments on commit 799d162

Please sign in to comment.