aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-08-01 10:41:08 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-08-02 11:56:51 +0800
commit582bf4f1e15988565da53a91395e2d0131628fbb (patch)
tree320f48a9beb4271a9ffd32eca0db526d3276de7c /runtime/lua/vim
parentf7fde0173af95925e7324b7d3c09776173dab8a7 (diff)
downloadrneovim-582bf4f1e15988565da53a91395e2d0131628fbb.tar.gz
rneovim-582bf4f1e15988565da53a91395e2d0131628fbb.tar.bz2
rneovim-582bf4f1e15988565da53a91395e2d0131628fbb.zip
vim-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'. https://github.com/vim/vim/commit/a4e0b9785e409e9e660171cea76dfcc5fdafad9b vim-patch:9.0.0635: build error and compiler warnings Problem: Build error and compiler warnings. Solution: Add missing change. Add type casts. https://github.com/vim/vim/commit/3292a229402c9892f5ab90645fbfe2b1db342f5b Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/_meta/options.lua24
1 files changed, 19 insertions, 5 deletions
diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua
index ebb6ee2329..10c888548c 100644
--- a/runtime/lua/vim/_meta/options.lua
+++ b/runtime/lua/vim/_meta/options.lua
@@ -786,6 +786,9 @@ vim.bo.channel = vim.o.channel
--- v:fname_out name of the output file
--- Note that v:fname_in and v:fname_out will never be the same.
---
+--- The advantage of using a function call without arguments is that it is
+--- faster, see `expr-option-function`.
+---
--- If the 'charconvert' expression starts with s: or `<SID>`, then it is
--- replaced with the script ID (`local-function`). Example:
---
@@ -2521,6 +2524,9 @@ vim.wo.fdt = vim.wo.foldtext
--- This will invoke the mylang#Format() function in the
--- autoload/mylang.vim file in 'runtimepath'. `autoload`
---
+--- The advantage of using a function call without arguments is that it is
+--- faster, see `expr-option-function`.
+---
--- The expression is also evaluated when 'textwidth' is set and adding
--- text beyond that limit. This happens under the same conditions as
--- when internal formatting is used. Make sure the cursor is kept in the
@@ -3286,12 +3292,15 @@ vim.go.inc = vim.go.include
--- the script ID (`local-function`). Example:
---
--- ```vim
---- setlocal includeexpr=s:MyIncludeExpr(v:fname)
---- setlocal includeexpr=<SID>SomeIncludeExpr(v:fname)
+--- setlocal includeexpr=s:MyIncludeExpr()
+--- setlocal includeexpr=<SID>SomeIncludeExpr()
--- ```
--- Otherwise, the expression is evaluated in the context of the script
--- where the option was set, thus script-local items are available.
---
+--- It is more efficient if the value is just a function call without
+--- arguments, see `expr-option-function`.
+---
--- The expression will be evaluated in the `sandbox` when set from a
--- modeline, see `sandbox-option`.
--- This option cannot be set in a modeline when 'modelineexpr' is off.
@@ -3366,6 +3375,9 @@ vim.go.is = vim.go.incsearch
--- Otherwise, the expression is evaluated in the context of the script
--- where the option was set, thus script-local items are available.
---
+--- The advantage of using a function call without arguments is that it is
+--- faster, see `expr-option-function`.
+---
--- The expression must return the number of spaces worth of indent. It
--- can return "-1" to keep the current indent (this means 'autoindent' is
--- used for the indent).
@@ -6314,9 +6326,11 @@ vim.bo.spo = vim.bo.spelloptions
--- The file is used for all languages.
---
--- expr:{expr} Evaluate expression {expr}. Use a function to avoid
---- trouble with spaces. `v:val` holds the badly spelled
---- word. The expression must evaluate to a List of
---- Lists, each with a suggestion and a score.
+--- trouble with spaces. Best is to call a function
+--- without arguments, see `expr-option-function|.
+--- |v:val` holds the badly spelled word. The expression
+--- must evaluate to a List of Lists, each with a
+--- suggestion and a score.
--- Example:
--- [['the', 33], ['that', 44]] ~
--- Set 'verbose' and use `z=` to see the scores that the