LaTeX forum ⇒ Othersvim in terminal and syntax highlight

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

vim in terminal and syntax highlight

Postby AliceWonderMisc » Fri May 24, 2019 6:28 am

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?

AliceWonderMisc
Posts: 17
Joined: Mon Aug 20, 2018 3:27 pm

Postby AliceWonderMisc » Fri May 24, 2019 6:33 am

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: 623
Joined: Tue Mar 25, 2008 5:02 pm

Postby kaiserkarl13 » Fri May 24, 2019 7:20 am

The line in tex.vim that sets up this particular piece of syntax highlighting is
  1. 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):
  1. :syntax region texZone start="\\begin{ManVerbatim}" end="\\end{ManVerbatim}\|%stopzone\>"

AliceWonderMisc
Posts: 17
Joined: Mon Aug 20, 2018 3:27 pm

Postby AliceWonderMisc » Fri May 24, 2019 12:53 pm

Thank you! Worked perfectly.

AliceWonderMisc
Posts: 17
Joined: Mon Aug 20, 2018 3:27 pm

Postby AliceWonderMisc » Sat May 25, 2019 12:14 am

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.


Return to “Others”

Who is online

Users browsing this forum: No registered users and 1 guest