Possible Duplicate:
Match word containing characters beyond a-zA-Z
I do not understand vim
s definition of a word. From the help for the motion w
(:h w
):
w [count] words forward. |exclusive| motion. These commands move over words or WORDS.
*word*
A word consists of a sequence of letters, digits and underscores, or a sequence of other non-blank characters, separated with white space (spaces, tabs, ). This can be changed with the 'iskeyword' option.
This means when I invoke the w
motion, vim needs to check which characters
can make up a word with the help of the iskeyword
option. So let's check,
what characters a word may be comprised of:
:set iskeyword?
iskeyword=@,48-57,_,192-255
Let's test this with characters not included in the characters
listed in the iskeyword
option, e.g. U+015B LATIN SMALL LETTER S
WITH ACUTE
. Pressing ga
on ś
tells us that it has the decimal
value 347, which is larger than 255 and thus outside the range of
iskeyword
. The cursor is placed on the t
of treść and I press w
:
treść bar
^ (cursor)
The result:
treść bar
^ (cursor)
If a word can be comprised of letters, digits, underscores and
other characters, the only possibility is that vim treats the ś
as
a letter, since it's obviously not a digit or an underscore.
Let's check how to find out if a character is a letter. From :h
:alpha:
:
The following character classes are supported: [:alpha:] [:alpha:] letters
A test with
/[[:alpha]]
shows that ś
is not considered to be a letter.
Why did the cursor jump to the b
if ś
is neither a letter,
nor a digit, nor an underscore and not listed in iskeyword
?
Tested on VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Dec 27 2012 21:21:18)
Included patches: 1-762 on Debian GNU/Linux with locale set to
en_GB.UTF-8
.