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