From 726d1a92d243a8b7cb4b221d64e4523b7a89aaf4 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 29 Jul 2026 19:09:48 +0200 Subject: feat(options): lua closure/function options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Cannot assign Lua functions/closures to "func" ('completefunc', 'tagfun', …) or "expr" ('foldexpr', 'indentexpr', …) options. Solution: - Store "func"/"expr" options as `Callback` instead of string. - Delete oceans of copy-pasted code. - BREAKING: LuaRef returned via RPC/Vimscript is now represented as `""` (like what `:map` shows) instead of `nil`. - Note: `man.vim` still uses `v:lua` string, bc it's a vimscript ftplugin. Helped-by: Lewis Russell --- runtime/lua/vim/_comment.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim/_comment.lua') diff --git a/runtime/lua/vim/_comment.lua b/runtime/lua/vim/_comment.lua index dbc2f38b34..7b137758d3 100644 --- a/runtime/lua/vim/_comment.lua +++ b/runtime/lua/vim/_comment.lua @@ -221,7 +221,7 @@ local function operator(mode) -- Used without arguments as part of expression mapping. Otherwise it is -- called as 'operatorfunc'. if mode == nil then - vim.o.operatorfunc = "v:lua.require'vim._comment'.operator" + vim.o.operatorfunc = operator return 'g@' end -- cgit