keymaps: switch to lua API vim.keymap.set (#115)

* modules/keymaps: switch to lua API vim.keymap.set

* add test for keymaps

Co-authored-by: Pedro Alves <pta2002@pta2002.com>
This commit is contained in:
Gaétan Lepage 2023-01-12 20:13:47 +01:00 committed by GitHub
parent 9aec0f9275
commit 5c6ba55f8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -117,14 +117,13 @@ in
(helpers.genMaps "c" config.maps.command); (helpers.genMaps "c" config.maps.command);
in in
{ {
# TODO: Use vim.keymap.set if on nvim >= 0.7
extraConfigLua = optionalString (mappings != [ ]) '' extraConfigLua = optionalString (mappings != [ ]) ''
-- Set up keybinds {{{ -- Set up keybinds {{{
do do
local __nixvim_binds = ${helpers.toLuaObject mappings} local __nixvim_binds = ${helpers.toLuaObject mappings}
for i, map in ipairs(__nixvim_binds) do for i, map in ipairs(__nixvim_binds) do
vim.api.nvim_set_keymap(map.mode, map.key, map.action, map.config) vim.keymap.set(map.mode, map.key, map.action, map.config)
end end
end end
-- }}} -- }}}

View file

@ -81,6 +81,10 @@
}; };
}; };
keymaps = build {
maps.normal."," = "<cmd>echo \"test\"<cr>";
};
issue-40 = build-stable { issue-40 = build-stable {
plugins = { plugins = {
nix.enable = true; nix.enable = true;