I am not using vim-latex, just the regular vim syntax highlighting for latex. To make sure of this I tested this by running:
vim -u NONE -N
I notice that if I am in math mode "f_a" will display with "_a" being the same color as the inside of "f_{a}" but when typing "f_b" the underscore displays red while "b" is the same color as f. I noticed that all numbers behave like a, and also a few other letters, including x, v, u and i. What is special about these letters? Why does the syntax consider them different?
Is there a flavor of TeX where the difference is meaningful? I am only familiar with LaTeX…
Best Answer
Recent versions of Vim have a new 'conceal text' function. The syntax highlighting file contains code to work with this feature. The conceal text function collapses a string of text into a single Unicode character. For example, it might visually substitute
\beta
withβ
.Vim provides substitutions for the following subscripts by default, replacing the string
_X
(where X is one of the following characters) with the Unicode subscript character:0
,1
,2
,3
,4
,5
,6
,7
,8
,9
,a
,e
,i
,o
,u
,,
(replaced with a vertical comma: U+FE10),+
,-
,/
,(
,)
,.
(replaced with a caret: U+2038),r
,v
,x
,\beta
,\delta
,\phi
,\gamma
,\chi
.The characters that are replaced will appear in a different color (depending on your color scheme and the current conceal mode).
To enable conceal mode, type
:set conceallevel=2
in Vim. You'll see these replacements (assuming you have a terminal font that supports the necessary Unicode characters). When your cursor is on a line, the concealed characters are revealed/expanded for easy editing. Use:set conceallevel=0
to disable the concealment.Vim has many more replacements for superscripts (as more fonts provide a wider variety of superscript glyphs than subscript glyphs).
The conceal mode becomes rather useful with it comes to mathematics:
is displayed as
To answer your questions more directly:
The only thing special about those letters are that Vim's syntax highlighting file provides functions to conceal those particular subscript letters with suitable Unicode glyphs.
Nope. It's all the same to TeX.