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/ftplugin/lua.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/ftplugin/lua.lua') diff --git a/runtime/ftplugin/lua.lua b/runtime/ftplugin/lua.lua index 7c54b2cb1e..914c4f8d4c 100644 --- a/runtime/ftplugin/lua.lua +++ b/runtime/ftplugin/lua.lua @@ -2,7 +2,7 @@ vim.treesitter.start() vim.bo.includeexpr = [[v:lua.require'vim._ftplugin.lua'.includeexpr(v:fname)]] -vim.bo.omnifunc = 'v:lua.vim.lua_omnifunc' +vim.bo.omnifunc = vim.lua_omnifunc vim.wo[0][0].foldexpr = 'v:lua.vim.treesitter.foldexpr()' vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') -- cgit