Skip to content

Commit

Permalink
feat(syntax): initial support for pyluatex
Browse files Browse the repository at this point in the history
refer: #2460
  • Loading branch information
lervag committed Aug 17, 2022
1 parent 411a22a commit 5641242
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
18 changes: 18 additions & 0 deletions autoload/vimtex/syntax/p/pyluatex.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
" VimTeX - LaTeX plugin for Vim
"
" Maintainer: Karl Yngve Lervåg
" Email: karl.yngve@gmail.com
"

function! vimtex#syntax#p#pyluatex#load(cfg) abort " {{{1
call vimtex#syntax#nested#include('python')

for l:env in ['python', 'pythonq', 'pythonrepl']
call vimtex#syntax#core#new_region_env(
\ 'texPyluatexZone', l:env, {'contains': '@vimtex_nested_python'})
endfor

highlight def link texCmdPyluatex texCmd
endfunction

" }}}1
18 changes: 18 additions & 0 deletions test/test-syntax/test-pyluatex.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
\documentclass{article}
\usepackage{pyluatex}

\begin{document}

\begin{python}
print("I am python but vimtex syntax highlighting does not know me")
\end{python}

\begin{pythonq}
print("I am python but vimtex syntax highlighting does not know me")
\end{pythonq}

\begin{pythonrepl}
print("I am python but vimtex syntax highlighting does not know me")
\end{pythonrepl}

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

silent edit test-pyluatex.tex

if empty($INMAKE) | finish | endif

call assert_true(vimtex#syntax#in('pythonString', 7, 13))
call assert_true(vimtex#syntax#in('pythonString', 11, 13))
call assert_true(vimtex#syntax#in('pythonString', 15, 13))

call vimtex#test#finished()

0 comments on commit 5641242

Please sign in to comment.