[EMAIL PROTECTED] wrote:
Hi vimmers, I've got some question when writing my syntax highlight script.
Q1.
The language requires a ^M character as a keyword. The ^M character is by
default highlighted but I want to highlight it to some other color, at
least it should be different from ^L and ^N...
It seems impossible to match the ^M by
:syn match Testgroup "^M"
(Note the ^M is obtained by press C-K, release, then press C-M, release,
then press <Enter>)
When using double quotes, you can match "\r" instead, but beware: ^M is the
carriage-return character, which has special meaning on Mac (where is is the
end-of-line character) and on Dos/Windows (where it, plus ^J [line feed]
together make an and-of-line). In general, using any character below 0x20 as a
"text" character is a bad choice.
and
:hi def link Testgroup Number
does not highlight it as desired. It seems always highlighted to some other
color.
Q2.
The string for the script language can be as long as 50-100 lines, when I
write a ":syn region" for string, it works but sometimes when I go page
down and page up, the lines of the string are highlighted as "Normal"
instead of "String", seems that the context are not concerned. Any work
around?
change the ":syn sync" statement, or add one to your syntax script or to your
vimrc, see ":help :syn-sync". I have a similar case where I have HTML pages
with extremely long blocks of italics, but since they are in one particular
project only, I use that project's directory as part of the match string in a
BufRead,BufNewFile autocommand with "syn sync fromstart" as the command.
Q3.
The first occurence of colon and the following occurences in a line have
different meanings.
So, if there are text: yyyy:xxxx:aaaa:bbbb;
I want to highlight the first colon as GroupA, and highlight all following
occurences of colon in the same line as GroupB. Is that possible?
Thanks in advance.
--
Sincerely, Pan, Shi Zhu. ext: 2606
Best regards,
Tony.