From 32c94621adeb1dca9bd70a6bfbbf8402806d4496 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 10 Feb 2026 06:43:09 +0800 Subject: [PATCH] vim-patch:9e456e5: runtime(doc): clarify the use of 'iskeyword' option value In particular, also mention the difference between the regex atom \k and what Vim considers for a word character. closes: vim/vim#18688 https://github.com/vim/vim/commit/9e456e52df83f64075ce94c9a5adc43e221a6d3c Co-authored-by: Christian Brabandt --- runtime/doc/motion.txt | 6 ++++-- runtime/doc/options.txt | 8 +++++++- runtime/lua/vim/_meta/options.lua | 8 +++++++- src/nvim/options.lua | 8 +++++++- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt index b87d74b920..a9ed65743b 100644 --- a/runtime/doc/motion.txt +++ b/runtime/doc/motion.txt @@ -410,8 +410,10 @@ 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. An empty line -is also considered to be a word. +tabs, ). This can be changed with the 'iskeyword' option. For +characters above 255, a word ends when the Unicode character class changes +(e.g., between letters, subscripts, emojis, etc). An empty line is also +considered to be a word. *WORD* A WORD consists of a sequence of non-blank characters, separated with white space. An empty line is also considered to be a WORD. diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index bbe2a634db..31185e4729 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -3803,7 +3803,13 @@ A jump table for the options with a short description can be found at |Q_op|. "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). + that is categorized as a letter, number or emoji according to the + Unicode general category). + + Note that there is a difference between the "\k" character class and + the |word| motion. The former matches any word character, while the + latter stops at a change of the character class. + 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 diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index c1e35052a2..bd0bbbafa4 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -3718,7 +3718,13 @@ vim.go.isi = vim.go.isident --- "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). +--- that is categorized as a letter, number or emoji according to the +--- Unicode general category). +--- +--- Note that there is a difference between the "\k" character class and +--- the `word` motion. The former matches any word character, while the +--- latter stops at a change of the character class. +--- --- 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 diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 373ec1993a..144982dce3 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -4895,7 +4895,13 @@ local options = { "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). + that is categorized as a letter, number or emoji according to the + Unicode general category). + + Note that there is a difference between the "\k" character class and + the |word| motion. The former matches any word character, while the + latter stops at a change of the character class. + 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