Skip to content

Commit

Permalink
feat(syntax): \iffalse as comment
Browse files Browse the repository at this point in the history
refer: #1988
  • Loading branch information
lervag committed May 30, 2021
1 parent 79593ef commit 549d80a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
8 changes: 8 additions & 0 deletions autoload/vimtex/syntax/core.vim
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,14 @@ function! vimtex#syntax#core#init() abort " {{{1
\ containedin=texComment contained
syntax case match

" Highlight \iffalse ... \fi blocks as comments
syntax region texComment matchgroup=texCmd
\ start="^\s*\\iffalse\>" end="\\fi\>"
\ contains=texCommentConditionals
syntax region texCommentConditionals matchgroup=texComment
\ start="\\if\w\+" end="\\fi\>"
\ contained transparent

" }}}2
" {{{2 Zone: Verbatim

Expand Down
22 changes: 22 additions & 0 deletions test/test-syntax/test-iffalse.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}

\let\if@tempswa\iffalse
\def\loop#1\repeat{\def\iterate{#1\relax\expandafter\iterate\fi}%
\iterate \let\iterate\relax}

\begin{document}

\iffalse
Commented stuff
Another \ifstuff here \fi
\ifasd \fi \f \fii

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 clita kasd
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
\fi

\end{document}

0 comments on commit 549d80a

Please sign in to comment.