mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-23 20:25:08 +02:00
modules/keymap: include buffer when registering keymapsOnEvents
This feels more correct to me: I believe we were registering a keymap for all buffers, even if only some of them have experienced the relevant autocmd. I don't know if it's guaranteed here that `args.buf` always exists (but maybe it's not a problem if it doesn't exist, because we'll still register a keymap for all buffers?). This fixes https://github.com/nix-community/nixvim/issues/2711
This commit is contained in:
parent
520c2868eb
commit
79a637d196
1 changed files with 4 additions and 2 deletions
|
@ -97,11 +97,13 @@
|
|||
inherit event;
|
||||
group = "nixvim_binds_${event}";
|
||||
callback = helpers.mkRaw ''
|
||||
function()
|
||||
function(args)
|
||||
do
|
||||
local __nixvim_binds = ${lib.nixvim.toLuaObject (map helpers.keymaps.removeDeprecatedMapAttrs mappings)}
|
||||
|
||||
for i, map in ipairs(__nixvim_binds) do
|
||||
vim.keymap.set(map.mode, map.key, map.action, map.options)
|
||||
local options = vim.tbl_extend("error", map.options or {}, { buffer = args.buf })
|
||||
vim.keymap.set(map.mode, map.key, map.action, options)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue