[vim/vim] Clarify "word" character class in 'isk' documentation. (#8155)

32 views
Skip to first unread message

Maxim Kim

unread,
Apr 28, 2021, 3:02:44 AM4/28/21
to vim/vim, Subscribed

If you do :h 'iskeyword' there will be a phrase:

For '@' characters above 255 check the "word" character class.

The question is what is this "word" character class?

Currently if I have привет мир unicode text in a buffer, I can match a letter with /\k but not with a /\w which I thought is the "word" character class...


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Bram Moolenaar

unread,
Apr 28, 2021, 6:01:32 AM4/28/21
to vim/vim, Subscribed


> If you do `:h 'iskeyword'` there will be a phrase:
>
> ```
> For '@' characters above 255 check the "word" character class.
> ```
>
> The question is what is this "word" character class?
>
> Currently if I have `привет мир` unicode text in a buffer, I can match
> a letter with `/\k` but not with a `/\w` which I thought is the "word"
> character class...

Hmm, I don't think this is clearly specified in the help. The \< and \>
regexp items mention start and end of word, which does use a similar
rule.

Best I can think of is "any character that is not white space or punctuation".

--
hundred-and-one symptoms of being an internet addict:
187. You promise yourself that you'll only stay online for another
15 minutes...at least once every hour.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

lacygoill

unread,
May 2, 2021, 12:54:50 PM5/2/21
to vim/vim, Subscribed

Possibly fixed by 4c29502

The help at :h 'isk' now says:

For '@' characters above 255 check the "word" character class (any character
that is not white space or punctuation).

Christian Brabandt

unread,
May 2, 2021, 1:21:39 PM5/2/21
to vim/vim, Subscribed

Closed #8155.

Maxim Kim

unread,
May 2, 2021, 2:02:35 PM5/2/21
to vim/vim, Subscribed

Yes, thank you.

I am still a bit confused by a "word" character class mention there as it doesn't match to what is defined for a regex word character class. Or maybe quotes in "word" means it is different?

lacygoill

unread,
May 2, 2021, 2:17:34 PM5/2/21
to vim/vim, Subscribed

I don't know. Maybe "word" character class refers to [[:keyword:]]? If so, the definition might be circular, because the latter is already defined via 'iskeyword'.

Maybe we could say this instead:

'@' characters above 255 match [^[:space:][:punct:]] (any character


that is not white space or punctuation).

diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 84969b23f..0ed431e9a 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -4563,9 +4563,9 @@ A jump table for the options with a short description can be found at |Q_op|.
 			local to buffer
 	Keywords are used in searching and recognizing with many commands:
 	"w", "*", "[i", etc.  It is also used for "\k" in a |pattern|.  See
-	'isfname' for a description of the format of this option.  For '@'
-	characters above 255 check the "word" character class (any character
-	that is not white space or punctuation).
+	'isfname' for a description of the format of this option.  '@'
+	characters above 255 match `[^[:space:][:punct:]]` (any character that
+	is not white space or punctuation).
 	For C programs you could use "a-z,A-Z,48-57,_,.,-,>".
 	For a help file it is set to all non-blank printable characters except
 	'*', '"' and '|' (so that CTRL-] on a command finds the help for that
Reply all
Reply to author
Forward
0 new messages