—[quote=“nesbit, post:23, topic:18660”]
However, I don’t exactly get what are the captures needed for.
[/quote]
captures
are to set different scopes to the different capture groups of the regular expression that matched.
A capture group in a regular expression is defined by parenthesis without a ?
after the opening parenthesis, and are numbered sequentially, starting from 1 (capture group 0 always refers to the entire match).
for example: - match: '(?:\s*)((\\)begin)(\{)(gnuplot)(\})'
here we have a group 1 for \\
, a group 2 for \\begin
, a group 3 for \{
, a group 4 for gnuplot
and a group 5 for \}
. Why is this useful? both for semantics, in terms of any snippets, auto-completions or plugins, but also so that the \begin
can be highlighted in one color, the {
and }
characters in other and the gnuplot
in yet another different color.
We can see that the original LaTeX syntax definition uses these captures on \begin{figure}
, to highlight \begin
differently to figure
, but where you have removed these captures for gnuplot
and lstlisting
, they are all one color. I hope that clarifies their use