Skip to content

Commit

Permalink
fix: make keymaps extendible
Browse files Browse the repository at this point in the history
  • Loading branch information
milkias17 committed Jul 15, 2023
1 parent 52dac28 commit b19e99e
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions lua/neogit/integrations/diffview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,20 @@ function M.open(section_name, item_name)

local config = dv_config.get_config()

local view_maps = {
["q"] = cb("close"),
["<esc>"] = cb("close"),
}
local file_panel_maps = {
["q"] = cb("close"),
["<esc>"] = cb("close"),
local keymaps = {
view = {
["q"] = cb("close"),
["<esc>"] = cb("close"),
},
file_panel = {
["q"] = cb("close"),
["<esc>"] = cb("close"),
},
}

config.keymaps.view = dv_config.extend_keymaps(view_maps, config.keymaps.view or {})
config.keymaps.file_panel = dv_config.extend_keymaps(file_panel_maps, config.keymaps.file_panel or {})
for key, keymap in pairs(keymaps) do
config.keymaps[key] = dv_config.extend_keymaps(keymap, config.keymaps[key] or {})
end

dv.setup(config)

Expand Down

0 comments on commit b19e99e

Please sign in to comment.