From 99bb0a10d3400ee8b9b2773d51a957dacbf52b33 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 2 Aug 2024 12:16:04 +0800 Subject: refactor(eval): treat v:lua call as simple function --- runtime/doc/options.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'runtime/doc') diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index b4eb3b6f28..bc2a8ae263 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -406,7 +406,14 @@ The value of a few options, such as 'foldexpr', is an expression that is evaluated to get a value. The evaluation can have quite a bit of overhead. One way to minimize the overhead, and also to keep the option value very simple, is to define a function and set the option to call it without -arguments. +arguments. A |v:lua-call| can also be used. Example: >vim + lua << EOF + function _G.MyFoldFunc() + -- ... compute fold level for line v:lnum + return level + end + EOF + set foldexpr=v:lua.MyFoldFunc() Setting the filetype -- cgit