|
1 | | -*options.txt* For Vim version 9.1. Last change: 2024 Oct 28 |
| 1 | +*options.txt* For Vim version 9.1. Last change: 2024 Nov 02 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -439,10 +439,11 @@ Note: In the future more global options can be made |global-local|. Using |
439 | 439 | ":setlocal" on a global option might work differently then. |
440 | 440 |
|
441 | 441 | *option-value-function* |
442 | | -Some options ('completefunc', 'imactivatefunc', 'imstatusfunc', 'omnifunc', |
443 | | -'operatorfunc', 'quickfixtextfunc', 'tagfunc' and 'thesaurusfunc') are set to |
444 | | -a function name or a function reference or a lambda function. When using a |
445 | | -lambda it will be converted to the name, e.g. "<lambda>123". Examples: |
| 442 | +Some options ('completefunc', 'findfunc', 'imactivatefunc', 'imstatusfunc', |
| 443 | +'omnifunc', 'operatorfunc', 'quickfixtextfunc', 'tagfunc' and 'thesaurusfunc') |
| 444 | +are set to a function name or a function reference or a lambda function. When |
| 445 | +using a lambda it will be converted to the name, e.g. "<lambda>123". |
| 446 | +Examples: |
446 | 447 | > |
447 | 448 | set opfunc=MyOpFunc |
448 | 449 | set opfunc=function('MyOpFunc') |
@@ -3552,55 +3553,55 @@ A jump table for the options with a short description can be found at |Q_op|. |
3552 | 3553 | eob EndOfBuffer |hl-EndOfBuffer| |
3553 | 3554 | lastline NonText |hl-NonText| |
3554 | 3555 |
|
3555 | | - *'findexpr'* *'fexpr'* *E1514* |
3556 | | -'findexpr' 'fexpr' string (default "") |
| 3556 | + *'findfunc'* *'ffu'* *E1514* |
| 3557 | +'findfunc' 'ffu' string (default empty) |
3557 | 3558 | global or local to buffer |global-local| |
3558 | 3559 | {not available when compiled without the |+eval| |
3559 | 3560 | feature} |
3560 | | - Expression that is evaluated to obtain the filename(s) for the |:find| |
| 3561 | + Function that is called to obtain the filename(s) for the |:find| |
3561 | 3562 | command. When this option is empty, the internal |file-searching| |
3562 | 3563 | mechanism is used. |
3563 | 3564 |
|
3564 | | - While evaluating the expression, the |v:fname| variable is set to the |
3565 | | - argument of the |:find| command. |
| 3565 | + The value can be the name of a function, a |lambda| or a |Funcref|. |
| 3566 | + See |option-value-function| for more information. |
3566 | 3567 |
|
3567 | | - The expression is evaluated only once per |:find| command invocation. |
3568 | | - The expression can process all the directories specified in 'path'. |
| 3568 | + The function is called with two arguments. The first argument is a |
| 3569 | + |String| and is the |:find| command argument. The second argument is |
| 3570 | + a |Boolean| and is set to |v:true| when the function is called to get |
| 3571 | + a List of command-line completion matches for the |:find| command. |
| 3572 | + The function should return a List of strings. |
3569 | 3573 |
|
3570 | | - The expression may be evaluated for command-line completion as well, |
3571 | | - in which case the |v:cmdcomplete| variable will be set to |v:true|, |
3572 | | - otherwise it will be set to |v:false|. |
| 3574 | + The function is called only once per |:find| command invocation. |
| 3575 | + The function can process all the directories specified in 'path'. |
3573 | 3576 |
|
3574 | | - If a match is found, the expression should return a |List| containing |
3575 | | - one or more file names. If a match is not found, the expression |
| 3577 | + If a match is found, the function should return a |List| containing |
| 3578 | + one or more file names. If a match is not found, the function |
3576 | 3579 | should return an empty List. |
3577 | 3580 |
|
3578 | | - If any errors are encountered during the expression evaluation, an |
| 3581 | + If any errors are encountered during the function invocation, an |
3579 | 3582 | empty List is used as the return value. |
3580 | 3583 |
|
3581 | | - Using a function call without arguments is faster |expr-option-function| |
3582 | | - |
3583 | 3584 | It is not allowed to change text or jump to another window while |
3584 | | - evaluating 'findexpr' |textlock|. |
| 3585 | + executing the 'findfunc' |textlock|. |
3585 | 3586 |
|
3586 | 3587 | This option cannot be set from a |modeline| or in the |sandbox|, for |
3587 | 3588 | security reasons. |
3588 | 3589 |
|
3589 | 3590 | Examples: |
3590 | 3591 | > |
3591 | 3592 | " Use glob() |
3592 | | - func FindExprGlob() |
3593 | | - let pat = v:cmdcomplete ? $'{v:fname}*' : v:fname |
| 3593 | + func FindFuncGlob(cmdarg, cmdcomplete) |
| 3594 | + let pat = a:cmdcomplete ? $'{a:cmdarg}*' : a:cmdarg |
3594 | 3595 | return glob(pat, v:false, v:true) |
3595 | 3596 | endfunc |
3596 | | - set findexpr=FindExprGlob() |
| 3597 | + set findfunc=FindFuncGlob |
3597 | 3598 |
|
3598 | 3599 | " Use the 'git ls-files' output |
3599 | | - func FindGitFiles() |
| 3600 | + func FindGitFiles(cmdarg, cmdcomplete) |
3600 | 3601 | let fnames = systemlist('git ls-files') |
3601 | | - return fnames->filter('v:val =~? v:fname') |
| 3602 | + return fnames->filter('v:val =~? a:cmdarg') |
3602 | 3603 | endfunc |
3603 | | - set findexpr=FindGitFiles() |
| 3604 | + set findfunc=FindGitFiles |
3604 | 3605 | < |
3605 | 3606 | *'fixendofline'* *'fixeol'* *'nofixendofline'* *'nofixeol'* |
3606 | 3607 | 'fixendofline' 'fixeol' boolean (default on) |
|
0 commit comments