diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2024-10-28 15:14:15 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2024-10-29 08:20:00 +0800 |
| commit | 378d9135e7ac0f91a4944be816dc9f693d5078af (patch) | |
| tree | 73d8ee9d95a9e1ae134e1eca0f8e741716290044 /runtime/doc | |
| parent | 42fa3d080ec170b7927e36ec563efdd526c712d7 (diff) | |
| download | rneovim-378d9135e7ac0f91a4944be816dc9f693d5078af.tar.gz rneovim-378d9135e7ac0f91a4944be816dc9f693d5078af.tar.bz2 rneovim-378d9135e7ac0f91a4944be816dc9f693d5078af.zip | |
vim-patch:9.1.0810: cannot easily adjust the |:find| command
Problem: cannot easily adjust the |:find| command
Solution: Add support for the 'findexpr' option (Yegappan Lakshmanan)
closes: vim/vim#15901
closes: vim/vim#15905
https://github.com/vim/vim/commit/aeb1c97db5b9de4f4903e7f288f2aa5ad6c49440
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'runtime/doc')
| -rw-r--r-- | runtime/doc/options.txt | 44 | ||||
| -rw-r--r-- | runtime/doc/quickref.txt | 1 | ||||
| -rw-r--r-- | runtime/doc/vvars.txt | 3 |
3 files changed, 47 insertions, 1 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 90f7f56ca2..17b2d22173 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -2598,6 +2598,50 @@ 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'* +'findexpr' 'fexpr' string (default "") + global or local to buffer |global-local| + 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'. + + 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() + return glob(v:fname, 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() +< + *'fixendofline'* *'fixeol'* *'nofixendofline'* *'nofixeol'* 'fixendofline' 'fixeol' boolean (default on) local to buffer diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index d77750b485..f64865a031 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -705,6 +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| '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 15d836a83d..3f9ce8cc96 100644 --- a/runtime/doc/vvars.txt +++ b/runtime/doc/vvars.txt @@ -254,7 +254,8 @@ v:fcs_reason *v:fname* *fname-variable* v:fname When evaluating 'includeexpr': the file name that was - detected. Empty otherwise. + detected. When evaluating 'findexpr': the argument passed to + the |:find| command. Empty otherwise. *v:fname_diff* *fname_diff-variable* v:fname_diff |