Othersvim in terminal and syntax highlight

Information and discussion about other LaTeX editors not listed above
Post Reply
AliceWonderMisc
Posts: 17
Joined: Mon Aug 20, 2018 3:27 pm

vim in terminal and syntax highlight

Post by AliceWonderMisc »

Hello,

I'm currently porting some man pages to LaTeX for the appendix of another documentation project I'm working on.

The color syntax works well enough but one issue -

When I use \begin{Verbatim} it can figure out that $ within are not the start of math.

however I'm actually using \begin{ManVerbatim} where I've defined ManVerbatim via \newtcblisting{ManVerbatim} {}

The vim syntax highlighting no longer figures out that $ within are not related to math mode.

Anyone know of a way to tell the vim syntax highlighting to treat my custom ManVerbatim as if it was verbatim or Verbatim?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
AliceWonderMisc
Posts: 17
Joined: Mon Aug 20, 2018 3:27 pm

vim in terminal and syntax highlight

Post by AliceWonderMisc »

The file presently working on where it is an issue -

https://gitlab.com/Pipfrosch/librelampd ... .cnf.5.tex

Line 326 (line number may change as I work on it) in the gitlab rendering shows where start of issue is - I don't care about gitlab getting it right, but it's annoying in vim where I am editing the file.
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

vim in terminal and syntax highlight

Post by kaiserkarl13 »

The line in tex.vim that sets up this particular piece of syntax highlighting is

Code: Select all

syntax region texZone           start="\\begin{[vV]erbatim}"            end="\\end{[vV]erbatim}\|%stopzone\>"
If you enter the following command, it will do the syntax highlighting the way you want it (just enter this right in VIM, with the colon, in command mode):

Code: Select all

:syntax region texZone           start="\\begin{ManVerbatim}"            end="\\end{ManVerbatim}\|%stopzone\>"
AliceWonderMisc
Posts: 17
Joined: Mon Aug 20, 2018 3:27 pm

vim in terminal and syntax highlight

Post by AliceWonderMisc »

Thank you! Worked perfectly.
AliceWonderMisc
Posts: 17
Joined: Mon Aug 20, 2018 3:27 pm

vim in terminal and syntax highlight

Post by AliceWonderMisc »

Note -

Also discovered (while reading the tex.vim file) that adding

%stopzone

to the LaTeX file also tells vim to restore normal syntax highlight when a custom Verbatim environment causes a problem.

Adding note here in case search engines send people here.
Post Reply