diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-10-29 07:02:04 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-10-29 08:20:00 +0800 |
commit | 60b3ccd850ca038af6fc0a19cad12578f63d67ec (patch) | |
tree | b18deb6eaae322957f27ae87e134f7c8bb3ee5e9 /runtime/lua/vim | |
parent | 6b8c3d146ec0308fd19a9142b23b5e342e2cdcf8 (diff) | |
download | rneovim-60b3ccd850ca038af6fc0a19cad12578f63d67ec.tar.gz rneovim-60b3ccd850ca038af6fc0a19cad12578f63d67ec.tar.bz2 rneovim-60b3ccd850ca038af6fc0a19cad12578f63d67ec.zip |
vim-patch:9.1.0821: 'findexpr' completion doesn't set v:fname to cmdline argument
Problem: 'findexpr' completion doesn't set v:fname to cmdline argument.
Solution: Set v:fname to the cmdline argument as-is (zeertzjq).
closes: vim/vim#15934
https://github.com/vim/vim/commit/20e045f78148c0ef0143c33ffe686fee72d29376
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r-- | runtime/lua/vim/_meta/options.lua | 7 | ||||
-rw-r--r-- | runtime/lua/vim/_meta/vvars.lua | 5 |
2 files changed, 11 insertions, 1 deletions
diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 8d5601ff6a..710f82bf21 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -2304,6 +2304,10 @@ vim.go.fcs = vim.go.fillchars --- The expression is evaluated only once per `:find` command invocation. --- The expression can process all the directories specified in 'path'. --- +--- The expression may be evaluated for command-line completion as well, +--- in which case the `v:cmdcomplete` variable will be set to `v:true`, +--- otherwise it will be set to `v:false`. +--- --- If a match is found, the expression should return a `List` containing --- one or more file names. If a match is not found, the expression --- should return an empty List. @@ -2324,7 +2328,8 @@ vim.go.fcs = vim.go.fillchars --- ```vim --- " Use glob() --- func FindExprGlob() ---- return glob(v:fname, v:false, v:true) +--- let pat = v:cmdcomplete ? $'{v:fname}*' : v:fname +--- return glob(pat, v:false, v:true) --- endfunc --- set findexpr=FindExprGlob() --- diff --git a/runtime/lua/vim/_meta/vvars.lua b/runtime/lua/vim/_meta/vvars.lua index cba200101b..b104356334 100644 --- a/runtime/lua/vim/_meta/vvars.lua +++ b/runtime/lua/vim/_meta/vvars.lua @@ -44,6 +44,11 @@ vim.v.cmdarg = ... --- @type integer vim.v.cmdbang = ... +--- When evaluating 'findexpr': if 'findexpr' is used for cmdline +--- completion the value is `v:true`, otherwise it is `v:false`. +--- @type boolean +vim.v.cmdcomplete = ... + --- The current locale setting for collation order of the runtime --- environment. This allows Vim scripts to be aware of the --- current locale encoding. Technical: it's the value of |