Skip to content

Commit

Permalink
test: add test files for g:vimtex_syntax_custom_envs
Browse files Browse the repository at this point in the history
  • Loading branch information
lervag committed Jul 12, 2023
1 parent b8a37f1 commit b722d88
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/test-syntax/test-custom-envs.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
\documentclass{minimal}

\usepackage{listings}
\lstnewenvironment{code}[1][]{\lstset{#1}}{}
\lstnewenvironment{python_code}{\lstset{language=python}}{}

\begin{document}

\begin{MyMathEnv}
f(x) = 1
\end{MyMathEnv}

\begin{python_code}
def test(argument: str) -> str:
"""
Test function.
"""
return argument
\end{python_code}

\begin{code}[language=rust]
fn main() {
println!("Hello World!");
}
\end{code}

\end{document}
20 changes: 20 additions & 0 deletions test/test-syntax/test-custom-envs.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
source common.vim

let g:vimtex_syntax_custom_envs = [
\ {'name': 'MyMathEnv', 'mathmode': 1},
\ {'name': 'python_code', 'nested': 'python'},
\ {
\ 'name': 'code',
\ 'nested': {
\ 'python': 'language=python',
\ 'c': 'language=C',
\ 'rust': 'language=rust',
\ },
\ },
\]

Edit test-custom-envs.tex

if empty($INMAKE) | finish | endif

call vimtex#test#finished()

0 comments on commit b722d88

Please sign in to comment.