admin管理员组文章数量:1432160
I see that :h nvim_set_keymap
has two ways of mapping: a lua-function or a vim-function that can be affected by the expr option, like passing a global Lua function via "v:lua.Func" to do something with it, I saw frequent use of that at. mini.nvim plugins
So my question is, what is the real use case for using one method over another?
function Func(arg)
print("call " .. arg)
end
vim.api.nvim_set_keymap(mode, lhs, "", {
callable = function()
Func("me")
end
})
vim.api.nvim_set_keymap(mode, lhs, 'v:lua.Func("me")', {
expr = true,
replace_termcodes = false
})
本文标签: Neovim(mapperf) Comparing expr and callable at nvimsetkeymapStack Overflow
版权声明:本文标题:Neovim(mapperf): Comparing `expr` and `callable` at `nvim_set_keymap` - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745586433a2664934.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论