Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim syntax file: Adding certain characters to iskeyword isn't working

Tags:

vim

unicode

I'm making a Vim syntax file, and I need to add some characters to the iskeyword option. I've had trouble figuring out how it works from the Vim help files, but this is what I've currently written:

set iskeyword+=_,.,-,64,133,!,?,@,172,8743,8744,8853,8592,8593,8594,8595,8596

#64 and #133 are the at sign and the ellipsis. The last few characters are ¬, ∧, ∨, ⊕, →, ←, ↓, ↑, and ↔.

Of all these characters, only _, ., -, and ¬ (#172) seem to be recognized as keyword characters.

Is there something else I have to do? Or does Vim simply not support keyword characters beyond a certain point in Unicode (but the at sign isn't being recognized either, and that's definitely within even ASCII)?

Thanks for your help!

like image 957
jschoi Avatar asked Feb 24 '23 05:02

jschoi


1 Answers

The help for iskeyword points to the help for isfname which answers all your questions:

[…]
Multi-byte characters 256 and above are always included, only the
characters up to 255 are specified with this option.
For UTF-8 the characters 0xa0 to 0xff are included as well.
[…]
The format of this option is a list of parts, separated with commas.
Each part can be a single character number or a range.  A range is two
character numbers with '-' in between.  A character number can be a
decimal number between 0 and 255 or the ASCII character itself (does
not work for digits).  Example:
[…]
If the character is '@', all characters where isalpha() returns TRUE
are included.  Normally these are the characters a to z and A to Z,
plus accented characters.  To include '@' itself use "@-@".  Examples:
    "@,^a-z"    All alphabetic characters, excluding lower
            case ASCII letters.
    "a-z,A-Z,@-@"   All letters plus the '@' character.
[…]
  1. "only the characters up to 255 are specified with this option."
  2. "A character number can be a decimal number between 0 and 255"
  3. "To include '@' itself use "@-@""

Including multi-byte characters in iskeyword has already been discussed in many lists, like this one.

like image 60
sidyll Avatar answered May 04 '23 01:05

sidyll