mirror of
https://github.com/neovim/neovim.git
synced 2026-08-01 21:29:09 +00:00
feat(options): lua closure/function options
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
`"<Lua N: file:line>"` (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 <lewis6991@gmail.com>
This commit is contained in:
@@ -1898,6 +1898,11 @@ describe('API', function()
|
||||
ok(not api.nvim_get_option_value('equalalways', {}))
|
||||
end)
|
||||
|
||||
it('Lua funcref RPC value is a `:map`-style "<Lua …>" string', function()
|
||||
exec_lua('vim.o.operatorfunc = function() end')
|
||||
matches('^<Lua %d+.*>$', api.nvim_get_option_value('operatorfunc', {}))
|
||||
end)
|
||||
|
||||
it('works to get global value of local options', function()
|
||||
eq(false, api.nvim_get_option_value('lisp', {}))
|
||||
eq(8, api.nvim_get_option_value('shiftwidth', {}))
|
||||
|
||||
Reference in New Issue
Block a user