summaryrefslogtreecommitdiffstats
path: root/runtime/doc/print.txt
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-10-01 19:43:52 +0100
committerBram Moolenaar <Bram@vim.org>2022-10-01 19:43:52 +0100
commita4e0b9785e409e9e660171cea76dfcc5fdafad9b (patch)
tree3323913d9bdc9cd09029b1314a77c4a5e8191bbf /runtime/doc/print.txt
parentb850c39676db21c6f1aa3afed0e2e48d407dd60e (diff)
patch 9.0.0634: evaluating "expr" options has more overhead than neededv9.0.0634
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'.
Diffstat (limited to 'runtime/doc/print.txt')
-rw-r--r--runtime/doc/print.txt11
1 files changed, 7 insertions, 4 deletions
diff --git a/runtime/doc/print.txt b/runtime/doc/print.txt
index 2774e981f6..9f8bb20879 100644
--- a/runtime/doc/print.txt
+++ b/runtime/doc/print.txt
@@ -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.