aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-03-07 08:18:33 +0800
committerzeertzjq <zeertzjq@outlook.com>2025-03-27 07:26:42 +0800
commit90d59e6c8aa6141c54f81586df423e5a76e009f9 (patch)
tree270e4b17b890ce56f1e0763385330f6b53edebbc /runtime
parent30293575204bc6b1cdc8a7e06af2710921d46da2 (diff)
downloadrneovim-90d59e6c8aa6141c54f81586df423e5a76e009f9.tar.gz
rneovim-90d59e6c8aa6141c54f81586df423e5a76e009f9.tar.bz2
rneovim-90d59e6c8aa6141c54f81586df423e5a76e009f9.zip
vim-patch:9.1.1178: not possible to generate completion candidates using fuzzy matching
Problem: not possible to generate completion candidates using fuzzy matching Solution: add the 'completefuzzycollect' option for (some) ins-completion modes (glepnir) fixes vim/vim#15296 fixes vim/vim#15295 fixes vim/vim#15294 closes: vim/vim#16032 https://github.com/vim/vim/commit/f31cfa29bf72b0cdf6fa1b60346ea4e187bcafd1 Co-authored-by: glepnir <glephunter@gmail.com>
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/news.txt3
-rw-r--r--runtime/doc/options.txt19
-rw-r--r--runtime/lua/vim/_meta/options.lua22
-rw-r--r--runtime/optwin.vim2
4 files changed, 43 insertions, 3 deletions
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index c0f3b31cf7..7bdacd73bf 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -131,7 +131,8 @@ LUA
OPTIONS
-• todo
+• 'completefuzzycollect' enables fuzzy collection of candidates for (some)
+ |ins-completion| modes.
PERFORMANCE
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index d477130a29..f44ea926b2 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1517,6 +1517,18 @@ A jump table for the options with a short description can be found at |Q_op|.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
+ *'completefuzzycollect'* *'cfc'*
+'completefuzzycollect' 'cfc' string (default "")
+ global
+ This option enables fuzzy collection for (only some) specific
+ |ins-completion| modes, adjusting how items are gathered for fuzzy
+ matching based on input.
+ The option can contain the following values (separated by commas),
+ each enabling fuzzy collection for a specific completion mode:
+ files file names
+ keyword keyword completion in 'complete' and current file
+ whole_line whole lines
+
*'completeitemalign'* *'cia'*
'completeitemalign' 'cia' string (default "abbr,kind,menu")
global
@@ -1536,7 +1548,12 @@ A jump table for the options with a short description can be found at |Q_op|.
fuzzy Enable |fuzzy-matching| for completion candidates. This
allows for more flexible and intuitive matching, where
characters can be skipped and matches can be found even
- if the exact sequence is not typed.
+ if the exact sequence is not typed. Note: This option
+ does not affect the collection of candidate list, it only
+ controls how completion candidates are reduced from the
+ list of alternatives. If you want to use |fuzzy-matching|
+ to gather more alternatives for your candidate list,
+ see |'completefuzzycollect'|.
longest Only insert the longest common text of the matches. If
the menu is displayed you can use CTRL-L to add more
diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua
index 58a8da4f26..cb199231c7 100644
--- a/runtime/lua/vim/_meta/options.lua
+++ b/runtime/lua/vim/_meta/options.lua
@@ -1044,6 +1044,21 @@ vim.o.cfu = vim.o.completefunc
vim.bo.completefunc = vim.o.completefunc
vim.bo.cfu = vim.bo.completefunc
+--- This option enables fuzzy collection for (only some) specific
+--- `ins-completion` modes, adjusting how items are gathered for fuzzy
+--- matching based on input.
+--- The option can contain the following values (separated by commas),
+--- each enabling fuzzy collection for a specific completion mode:
+--- files file names
+--- keyword keyword completion in 'complete' and current file
+--- whole_line whole lines
+---
+--- @type string
+vim.o.completefuzzycollect = ""
+vim.o.cfc = vim.o.completefuzzycollect
+vim.go.completefuzzycollect = vim.o.completefuzzycollect
+vim.go.cfc = vim.go.completefuzzycollect
+
--- A comma-separated list of strings that controls the alignment and
--- display order of items in the popup menu during Insert mode
--- completion. The supported values are "abbr", "kind", and "menu".
@@ -1063,7 +1078,12 @@ vim.go.cia = vim.go.completeitemalign
--- fuzzy Enable `fuzzy-matching` for completion candidates. This
--- allows for more flexible and intuitive matching, where
--- characters can be skipped and matches can be found even
---- if the exact sequence is not typed.
+--- if the exact sequence is not typed. Note: This option
+--- does not affect the collection of candidate list, it only
+--- controls how completion candidates are reduced from the
+--- list of alternatives. If you want to use `fuzzy-matching`
+--- to gather more alternatives for your candidate list,
+--- see `'completefuzzycollect'`.
---
--- longest Only insert the longest common text of the matches. If
--- the menu is displayed you can use CTRL-L to add more
diff --git a/runtime/optwin.vim b/runtime/optwin.vim
index dff3ce39a4..bfeb3367a7 100644
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -725,6 +725,8 @@ endif
if has("insert_expand")
call <SID>AddOption("complete", gettext("specifies how Insert mode completion works for CTRL-N and CTRL-P"))
call append("$", "\t" .. s:local_to_buffer)
+ call <SID>OptionL("cfc")
+ call <SID>AddOption("completefuzzycollect", gettext("using fuzzy collect for defaule completion mode"))
call <SID>OptionL("cpt")
call <SID>AddOption("completeopt", gettext("whether to use a popup menu for Insert mode completion"))
call <SID>OptionL("cot")