Today I installed the nightly version and as I was reading the documents of vim.keymap.set()
, this got my attention:
Note that in a mapping like:
vim.keymap.set('n', 'asdf', require('jkl').my_fun)
the `require('jkl')` gets evaluated during this call in order to access the
function. If you want to avoid this cost at startup you can
wrap it in a function, for example:
vim.keymap.set('n', 'asdf', function() return require('jkl').my_fun() end)
And I’m curious if the same thing applies to this mapping:
vim.api.nvim_set_keymap('n', 'asdf', ':lua require("jkl").my_fun')