patch 9.0.0634: evaluating "expr" options has more overhead than needed
Problem: Evaluating "expr" options has more overhead than needed.
Solution: Use call_simple_func() for 'foldtext', 'includeexpr', 'printexpr',
"expr" of 'spellsuggest', 'diffexpr', 'patchexpr', 'balloonexpr',
'formatexpr', 'indentexpr' and 'charconvert'.
This commit is contained in:
@ -158,13 +158,16 @@ currently specified printdevice: >
|
||||
If you change this option, using a function is an easy way to avoid having to
|
||||
escape all the spaces. Example: >
|
||||
|
||||
:set printexpr=PrintFile(v:fname_in)
|
||||
:function PrintFile(fname)
|
||||
: call system("ghostview " .. a:fname)
|
||||
: call delete(a:fname)
|
||||
:set printexpr=PrintFile()
|
||||
:function PrintFile()
|
||||
: call system("ghostview " .. v:fname_in)
|
||||
: call delete(v:fname_in)
|
||||
: return v:shell_error
|
||||
:endfunc
|
||||
|
||||
It is more efficient if the option is set to just a function call,
|
||||
see |expr-option-function|.
|
||||
|
||||
Be aware that some print programs return control before they have read the
|
||||
file. If you delete the file too soon it will not be printed. These programs
|
||||
usually offer an option to have them remove the file when printing is done.
|
||||
|
||||
Reference in New Issue
Block a user