I am heavily using gnuplottex for years now, and I have massaged my vim editor syntax highlighting in a way that, inside gnuplot environments, the gnuplot source code is displayed with gnuplot syntax highlighting (and not TeX).
This was originally a remedy in case of an odd number of ($1):($2)… column specifiers messing up with TeX's math mode highlighting, but has proven very helpful in various contexts over the years.
" Place this file somewhere where your vim sources it after the syntax
" highlighting definitions of TeX.
" Source gnuplot syntax file, but without the 'end' keyword
unlet b:current_syntax
syn include @gnuplottex !sed 's/\<end\>//' syntax/gnuplot.vim
let b:current_syntax = "tex"
" Match ignored stuff after \end{gnuplot}
syn match gnuplottexEOL ".*$" contained
" Define match region between gnuplot environment delimiters, containing
" gnuplot syntax highlighting
syn region texParaZone matchgroup=gnuplottex start="\\begin{gnuplot}"he=e+3 end="\\end{gnuplot}.*$"he=s+12 contains=@gnuplottex,texBeginEnd nextgroup=gnuplottexEOL
" Colouration of gnuplottex matches
hi link gnuplottex PreCondit
hi link gnuplottexEOL Error
It is not a masterpiece of code quality, but it may be useful for someone else though.
I'm not quite sure where the best place for such a code snippet is. Somewhere here, because it is closest to the main audience (the gnuplottex users)? By the vim syntax upstream at https://github.com/vim/vim/tree/master/runtime/syntax? Some vim plugin (a new one when in doubt)?
I am heavily using gnuplottex for years now, and I have massaged my vim editor syntax highlighting in a way that, inside gnuplot environments, the gnuplot source code is displayed with gnuplot syntax highlighting (and not TeX). This was originally a remedy in case of an odd number of
($1):($2)…
column specifiers messing up with TeX's math mode highlighting, but has proven very helpful in various contexts over the years.It is not a masterpiece of code quality, but it may be useful for someone else though. I'm not quite sure where the best place for such a code snippet is. Somewhere here, because it is closest to the main audience (the gnuplottex users)? By the vim syntax upstream at https://github.com/vim/vim/tree/master/runtime/syntax? Some vim plugin (a new one when in doubt)?