Open Janfel opened 2 years ago
This would be so amazing!!!!
once these keymaps are set in lua then it will be much easier to do this.
@akinsho I would like to take a stab at a PR for this. Could you please provide quick pointers/guidance on where to start or todo items?
@tricktux this isn't possible currently, lazy loads by key are created as string for compilation, until they are created in lua which will require v2 (a rewrite almost) of packer then you will not be able to do this as lua functions rather than strings.
I see... Okay.
Describe the feature
The
keys
key in apacker.use()
declaration should be able to accept mapping definitions like the following, similar to the:bind
key ofuse-package
.In addition to defining those mappings as autoloads, the
config
block ofpacker_compiled.lua
should then contain the correspondingvim.keymap.set()
calls. This would allow the user to keep their plugin-specific bindings in one place and have them autoload the plugin with almost no extra effort, just like they would do withuse-package
in Emacs.Because the translation of mapping specs into
vim.keymap.set()
calls would happen at compiletime, there should be no additional startup cost to this feature.Currently this feature can be emulated by using a
config
value offunction(_, plugin) require("config.utils").bind(plugin.keys) end
with a correspondingconfig.utils.bind()
function, because extraneous values in akeys
spec are passed along and ignored.