aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/options.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-10-29 09:01:46 +0800
committerGitHub <noreply@github.com>2024-10-29 09:01:46 +0800
commit0e32c480604d76a319602656f2d8e2722497606e (patch)
treeb18deb6eaae322957f27ae87e134f7c8bb3ee5e9 /src/nvim/options.lua
parent42fa3d080ec170b7927e36ec563efdd526c712d7 (diff)
parent60b3ccd850ca038af6fc0a19cad12578f63d67ec (diff)
downloadrneovim-0e32c480604d76a319602656f2d8e2722497606e.tar.gz
rneovim-0e32c480604d76a319602656f2d8e2722497606e.tar.bz2
rneovim-0e32c480604d76a319602656f2d8e2722497606e.zip
Merge pull request #30979 from zeertzjq/vim-9.1.0810
vim-patch:9.1.{0810,0811,0821}: 'findexpr'
Diffstat (limited to 'src/nvim/options.lua')
-rw-r--r--src/nvim/options.lua59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/nvim/options.lua b/src/nvim/options.lua
index a891d18364..d59958eaf2 100644
--- a/src/nvim/options.lua
+++ b/src/nvim/options.lua
@@ -2906,6 +2906,65 @@ return {
varname = 'p_fcs',
},
{
+ abbreviation = 'fexpr',
+ cb = 'did_set_optexpr',
+ defaults = { if_true = '' },
+ desc = [=[
+ Expression that is evaluated to obtain the filename(s) for the |:find|
+ command. When this option is empty, the internal |file-searching|
+ mechanism is used.
+
+ While evaluating the expression, the |v:fname| variable is set to the
+ argument of the |:find| command.
+
+ 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.
+
+ If any errors are encountered during the expression evaluation, an
+ empty List is used as the return value.
+
+ Using a function call without arguments is faster |expr-option-function|
+
+ It is not allowed to change text or jump to another window while
+ evaluating 'findexpr' |textlock|.
+
+ This option cannot be set from a |modeline| or in the |sandbox|, for
+ security reasons.
+
+ Examples:
+ >vim
+ " Use glob()
+ func FindExprGlob()
+ let pat = v:cmdcomplete ? $'{v:fname}*' : v:fname
+ return glob(pat, v:false, v:true)
+ endfunc
+ set findexpr=FindExprGlob()
+
+ " Use the 'git ls-files' output
+ func FindGitFiles()
+ let fnames = systemlist('git ls-files')
+ return fnames->filter('v:val =~? v:fname')
+ endfunc
+ set findexpr=FindGitFiles()
+ <
+ ]=],
+ full_name = 'findexpr',
+ scope = { 'global', 'buffer' },
+ secure = true,
+ short_desc = N_('expression used for :find'),
+ tags = { 'E1514' },
+ type = 'string',
+ varname = 'p_fexpr',
+ },
+ {
abbreviation = 'fixeol',
cb = 'did_set_eof_eol_fixeol_bomb',
defaults = { if_true = true },