Harald Kröll wrote:
> a command or script to count the characters without syntax words. For
> example for people who write LaTeX documents in vim and have to
> control their length...
That depends on the definition of a control word.
If you only want to exclude \backslash_prefixed \words, and nothing
else, then this will do:
:%s/\(\\\w*\)\@<!\w//gn
Explanation (right to left):
//gn count ALL…
\w …letters, numbers, and underscores…
\@<! …NOT preceded by…
\( \\ \w* \) …a backslash and possibly other letters/numbers
I'm not too familiar with Latex syntax, but if you wanted to exclude
\this[kind of thing] as well, it wouldn't be hard:
:%s/\v(\\\w*(\[[^]]*)?)@<!\w//gn
(
\\
\w*
(
\[
[^]]*
)?
)@<!
\w
Tobia