I'm using a perl script that has
"use utf8;" at the top that enables use of UTF-8 in variable names.
So in one place, instead of
my "@deltaio";
...
$total_io += $deltaio[$Tbytes];
I have:
my @Δio;
...
$total_io += $Δio[$Tbytes];
(note: 'Δ' = U+0394: GREEK CAPITAL LETTER DELTA)
---
My question/problem is how to update the syntax coloring file,
"perl.vim" to correctly accommodate UTF-8 variable names?
Is this even possible in vim?
I see:
syn match perlVarPlain "$^[ACDEFHILMNOPRSTVWX]\="
in the perl.vim file for matching alphabet chars in a variable name,
How would I specify that it match alphabet characters of any language?
Unicode has 'properties' assigned to characters, that allow one to tell what
class a codepoint (or character) falls into.
Perl allows specifying the base Unicode properties as well as some
derived properties to aid in classifying. For Alphabetic characters,
Unicode has the properties (with Short and Long versions):
Short Long
L Letter
LC CasedLetter
Lu UppercaseLetter
Ll LowercaseLetter
Lt TitlecaseLetter
Lm ModifierLetter
Lo OtherLetter
Nl NumberLetter
In regular expressions, in Perl, these can be specified with \p{PROPNAME}.
One can use the short or long form, so "\p{Lu}" is equivalent to
"\p{UppercaseLetter}".
Unicode also has names for the various 'scripts' like "Arabic, Braille,
Latin, etc... that can also be specified in Regex's, e.g.: \p{Arabic}.
There are also 'extended property classes' in Unicode defined in the
'proplist' Unicode database, including things like (abbreviated list).
ASCIIHexDigit
HexDigit
OtherAlphabetic
OtherLowercase
OtherMath
OtherUppercase
PatternSyntax
PatternWhiteSpace
QuotationMark
TerminalPunctuation
WhiteSpace
Some additional, 'derived' properties are available in perl as well:
Alphabetic (= Lu + Ll + Lt + Lm + Lo + Nl + OtherAlphabetic),
Lowercase, Uppercase, Math, ASCII, etc..
The proplist and derived props are also described in RE's via the same
syntax, e.g.: \p{Alphabetic}
Does Vim have anything similar to this?
I didn't know this until recently, but javascript's Regex syntax follows, or
was adopted from Perl as well, though I don't know how complete the
implementation is (i.e. if it includes UTF-8).
To implement the syntax hilighting changes I want, is this something that
would require an enhancement to vim? Or, alternately, how would
I go about adding syntax highlighting to perl that allows UTF-8
variable names?
Thanks!
Linda
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php