I'm trying to optimize for my needs the syntax highlighting offered automatically by Vim for Latex. For example by changing colors to my liking or link colors to new commands/environemnts.
After a good morning of googling I found out the following:
- One should not amend the
tex.vim
file in the vim app folder (for mac) directly. Instead add atex.vim
file in the folder.vim/after/syntax
containing all the desired amendments. - This works like a charm to change colors. For instance I can write (in such file):
highlight texMathZoneX guifg='#83a598'
, which changes the colour of text associated to the textMathZoneX group. - On the other hand, I could not find a working way to make changes to the groups themselves: below follows an extremely simple example.
MWE: I would like the word red
to be written with in white with red background. Eventually I would like all the text within a command \red{this text should be red in Vim}
to appear with a red background.
- Is there a way to create a new group, add it to the list of groups and then define the required colour on that group, so that the settings work also inside the document (and not just above the documentclass command)?
Adding the line :syn match texMathError "red"
gives for instance the right result, but only above the header: