diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/options.txt | 53 | ||||
-rw-r--r-- | runtime/doc/quickref.txt | 2 | ||||
-rw-r--r-- | runtime/doc/vvars.txt | 8 | ||||
-rw-r--r-- | runtime/lua/vim/_meta/options.lua | 52 | ||||
-rw-r--r-- | runtime/lua/vim/_meta/vvars.lua | 8 |
5 files changed, 56 insertions, 67 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index feaff3e425..8877054b77 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -370,10 +370,11 @@ Note: In the future more global options can be made |global-local|. Using ":setlocal" on a global option might work differently then. *option-value-function* -Some options ('completefunc', 'omnifunc', 'operatorfunc', 'quickfixtextfunc', -'tagfunc' and 'thesaurusfunc') are set to a function name or a function -reference or a lambda function. When using a lambda it will be converted to -the name, e.g. "<lambda>123". Examples: +Some options ('completefunc', 'findfunc', 'omnifunc', 'operatorfunc', +'quickfixtextfunc', 'tagfunc' and 'thesaurusfunc') are set to a function name +or a function reference or a lambda function. When using a lambda it will be +converted to the name, e.g. "<lambda>123". +Examples: > set opfunc=MyOpFunc set opfunc=function('MyOpFunc') @@ -2598,34 +2599,34 @@ A jump table for the options with a short description can be found at |Q_op|. eob EndOfBuffer |hl-EndOfBuffer| lastline NonText |hl-NonText| - *'findexpr'* *'fexpr'* *E1514* -'findexpr' 'fexpr' string (default "") + *'findfunc'* *'ffu'* *E1514* +'findfunc' 'ffu' string (default "") global or local to buffer |global-local| - Expression that is evaluated to obtain the filename(s) for the |:find| + Function that is called 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 value can be the name of a function, a |lambda| or a |Funcref|. + See |option-value-function| for more information. - The expression is evaluated only once per |:find| command invocation. - The expression can process all the directories specified in 'path'. + The function is called with two arguments. The first argument is a + |String| and is the |:find| command argument. The second argument is + a |Boolean| and is set to |v:true| when the function is called to get + a List of command-line completion matches for the |:find| command. + The function should return a List of strings. - 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|. + The function is called only once per |:find| command invocation. + The function can process all the directories specified in 'path'. - 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 + If a match is found, the function should return a |List| containing + one or more file names. If a match is not found, the function should return an empty List. - If any errors are encountered during the expression evaluation, an + If any errors are encountered during the function invocation, 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|. + executing the 'findfunc' |textlock|. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. @@ -2633,18 +2634,18 @@ A jump table for the options with a short description can be found at |Q_op|. Examples: >vim " Use glob() - func FindExprGlob() - let pat = v:cmdcomplete ? $'{v:fname}*' : v:fname + func FindFuncGlob(cmdarg, cmdcomplete) + let pat = a:cmdcomplete ? $'{a:cmdarg}*' : a:cmdarg return glob(pat, v:false, v:true) endfunc - set findexpr=FindExprGlob() + set findfunc=FindFuncGlob " Use the 'git ls-files' output - func FindGitFiles() + func FindGitFiles(cmdarg, cmdcomplete) let fnames = systemlist('git ls-files') - return fnames->filter('v:val =~? v:fname') + return fnames->filter('v:val =~? a:cmdarg') endfunc - set findexpr=FindGitFiles() + set findfunc=FindGitFiles < *'fixendofline'* *'fixeol'* *'nofixendofline'* *'nofixeol'* diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index f64865a031..f43ddb57fb 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -705,7 +705,7 @@ Short explanation of each option: *option-list* 'fileignorecase' 'fic' ignore case when using file names 'filetype' 'ft' type of file, used for autocommands 'fillchars' 'fcs' characters to use for displaying special items -'findexpr' 'fexpr' expression to evaluate for |:find| +'findfunc' 'ffu' function to be called for the |:find| command 'fixendofline' 'fixeol' make sure last line in file has <EOL> 'foldclose' 'fcl' close a fold when the cursor leaves it 'foldcolumn' 'fdc' width of the column used to indicate folds diff --git a/runtime/doc/vvars.txt b/runtime/doc/vvars.txt index 1c1d88c29c..15d836a83d 100644 --- a/runtime/doc/vvars.txt +++ b/runtime/doc/vvars.txt @@ -48,11 +48,6 @@ 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 @@ -259,8 +254,7 @@ v:fcs_reason *v:fname* *fname-variable* v:fname When evaluating 'includeexpr': the file name that was - detected. When evaluating 'findexpr': the argument passed to - the |:find| command. Empty otherwise. + detected. Empty otherwise. *v:fname_diff* *fname_diff-variable* v:fname_diff diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 5e5b6b5ed1..f9886957a7 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -2294,31 +2294,31 @@ vim.wo.fcs = vim.wo.fillchars vim.go.fillchars = vim.o.fillchars vim.go.fcs = vim.go.fillchars ---- Expression that is evaluated to obtain the filename(s) for the `:find` +--- Function that is called 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 value can be the name of a function, a `lambda` or a `Funcref`. +--- See `option-value-function` for more information. --- ---- The expression is evaluated only once per `:find` command invocation. ---- The expression can process all the directories specified in 'path'. +--- The function is called with two arguments. The first argument is a +--- `String` and is the `:find` command argument. The second argument is +--- a `Boolean` and is set to `v:true` when the function is called to get +--- a List of command-line completion matches for the `:find` command. +--- The function should return a List of strings. --- ---- 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`. +--- The function is called only once per `:find` command invocation. +--- The function can process all the directories specified in 'path'. --- ---- 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 +--- If a match is found, the function should return a `List` containing +--- one or more file names. If a match is not found, the function --- should return an empty List. --- ---- If any errors are encountered during the expression evaluation, an +--- If any errors are encountered during the function invocation, 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`. +--- executing the 'findfunc' `textlock`. --- --- This option cannot be set from a `modeline` or in the `sandbox`, for --- security reasons. @@ -2327,28 +2327,28 @@ vim.go.fcs = vim.go.fillchars --- --- ```vim --- " Use glob() ---- func FindExprGlob() ---- let pat = v:cmdcomplete ? $'{v:fname}*' : v:fname +--- func FindFuncGlob(cmdarg, cmdcomplete) +--- let pat = a:cmdcomplete ? $'{a:cmdarg}*' : a:cmdarg --- return glob(pat, v:false, v:true) --- endfunc ---- set findexpr=FindExprGlob() +--- set findfunc=FindFuncGlob --- --- " Use the 'git ls-files' output ---- func FindGitFiles() +--- func FindGitFiles(cmdarg, cmdcomplete) --- let fnames = systemlist('git ls-files') ---- return fnames->filter('v:val =~? v:fname') +--- return fnames->filter('v:val =~? a:cmdarg') --- endfunc ---- set findexpr=FindGitFiles() +--- set findfunc=FindGitFiles --- ``` --- --- --- @type string -vim.o.findexpr = "" -vim.o.fexpr = vim.o.findexpr -vim.bo.findexpr = vim.o.findexpr -vim.bo.fexpr = vim.bo.findexpr -vim.go.findexpr = vim.o.findexpr -vim.go.fexpr = vim.go.findexpr +vim.o.findfunc = "" +vim.o.ffu = vim.o.findfunc +vim.bo.findfunc = vim.o.findfunc +vim.bo.ffu = vim.bo.findfunc +vim.go.findfunc = vim.o.findfunc +vim.go.ffu = vim.go.findfunc --- When writing a file and this option is on, <EOL> at the end of file --- will be restored if missing. Turn this option off if you want to diff --git a/runtime/lua/vim/_meta/vvars.lua b/runtime/lua/vim/_meta/vvars.lua index b104356334..e00402ab3f 100644 --- a/runtime/lua/vim/_meta/vvars.lua +++ b/runtime/lua/vim/_meta/vvars.lua @@ -44,11 +44,6 @@ 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 @@ -272,8 +267,7 @@ vim.v.fcs_choice = ... vim.v.fcs_reason = ... --- When evaluating 'includeexpr': the file name that was ---- detected. When evaluating 'findexpr': the argument passed to ---- the `:find` command. Empty otherwise. +--- detected. Empty otherwise. --- @type string vim.v.fname = ... |