From ef0ec7edac5b7923955998ebddbfe02a1146bbf3 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 9 Jul 2025 07:38:43 +0800 Subject: vim-patch:9.1.1526: completion: search completion match may differ in case Problem: completion: search completion match may differ in case (techntools) Solution: add "exacttext" to 'wildoptions' value (Girish Palya) This flag does the following: exacttext When this flag is present, search pattern completion (e.g., in |/|, |?|, |:s|, |:g|, |:v|, and |:vim|) shows exact buffer text as menu items, without preserving regex artifacts like position anchors (e.g., |/\<|). This provides more intuitive menu items that match the actual buffer text. However, searches may be less accurate since the pattern is not preserved exactly. By default, Vim preserves the typed pattern (with anchors) and appends the matched word. This preserves search correctness, especially when using regular expressions or with 'smartcase' enabled. However, the case of the appended matched word may not exactly match the case of the word in the buffer. fixes: vim/vim#17654 closes: vim/vim#17667 https://github.com/vim/vim/commit/93c2d5bf7f01db594a3f5ebecbd5a31dfd411544 Co-authored-by: Girish Palya --- src/nvim/options.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/nvim/options.lua') diff --git a/src/nvim/options.lua b/src/nvim/options.lua index d320e0928a..570d0a6d35 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -10117,6 +10117,7 @@ local options = { < 'wildchar' also enables completion in search pattern contexts such as |/|, |?|, |:s|, |:g|, |:v|, and |:vim|. To insert a literal instead of triggering completion, type or "\t". + See also |'wildoptions'|. ]=], full_name = 'wildchar', scope = { 'global' }, @@ -10311,12 +10312,26 @@ local options = { { abbreviation = 'wop', defaults = 'pum,tagfile', - values = { 'fuzzy', 'tagfile', 'pum' }, + values = { 'fuzzy', 'tagfile', 'pum', 'exacttext' }, flags = true, deny_duplicates = true, desc = [=[ A list of words that change how |cmdline-completion| is done. The following values are supported: + exacttext When this flag is present, search pattern completion + (e.g., in |/|, |?|, |:s|, |:g|, |:v|, and |:vim|) + shows exact buffer text as menu items, without + preserving regex artifacts like position + anchors (e.g., |/\\<|). This provides more intuitive + menu items that match the actual buffer text. + However, searches may be less accurate since the + pattern is not preserved exactly. + By default, Vim preserves the typed pattern (with + anchors) and appends the matched word. This preserves + search correctness, especially when using regular + expressions or with 'smartcase' enabled. However, the + case of the appended matched word may not exactly + match the case of the word in the buffer. fuzzy Use |fuzzy-matching| to find completion matches. When this value is specified, wildcard expansion will not be used for completion. The matches will be sorted by -- cgit