aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/options.txt7
-rw-r--r--runtime/doc/vvars.txt5
-rw-r--r--runtime/lua/vim/_meta/options.lua7
-rw-r--r--runtime/lua/vim/_meta/vvars.lua5
4 files changed, 22 insertions, 2 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 441f180177..7f95a19918 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -2611,6 +2611,10 @@ A jump table for the options with a short description can be found at |Q_op|.
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.
@@ -2630,7 +2634,8 @@ A jump table for the options with a short description can be found at |Q_op|.
>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/doc/vvars.txt b/runtime/doc/vvars.txt
index 3f9ce8cc96..1c1d88c29c 100644
--- a/runtime/doc/vvars.txt
+++ b/runtime/doc/vvars.txt
@@ -48,6 +48,11 @@ v:cmdbang
can only be used in autocommands. For user commands |<bang>|
can be used.
+ *v:cmdcomplete* *cmdcomplete-variable*
+v:cmdcomplete
+ When evaluating 'findexpr': if 'findexpr' is used for cmdline
+ completion the value is |v:true|, otherwise it is |v:false|.
+
*v:collate* *collate-variable*
v:collate
The current locale setting for collation order of the runtime
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