I have some Lua function in a module, which in Lua I might call as require('a/b').zap(x, y, z)
.
Is there some way to “map” or “alias” this Lua function directly to a Vimscript function? Currently the best I could do was to use luaeval
:
function! Zap() abort
call luaeval('require("a/b").zap(_A[1], _A[2], _A[3])', [x, y, z])
endfunction
But this seems a little clunky. It would be great if I could do something like this instead:
call nvim_map_luafunc("Zap", {'module': 'a/b', 'name': 'zap'})
Or even (from Lua):
vim.api.map_luafunc("Zap", function() ... end)
I could probably write my own version of this without too much difficulty, but it would be nice if this were built into Neovim somehow. Does this exist and I missed it in the manual, or is this effectively a feature request?