Skip to content

Commit

Permalink
Merge pull request #589 from milkias17/diffview-mappings
Browse files Browse the repository at this point in the history
fix: make neogit respect user's configuration of diffview
  • Loading branch information
ten3roberts authored Jul 18, 2023
2 parents fbc5d41 + 3a2eec4 commit 10eaae0
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions lua/neogit/integrations/diffview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,24 @@ local function get_local_diff_view(selected_file_name)
end

function M.open(section_name, item_name)
old_config = dv_config.get_config()
old_config = vim.deepcopy(dv_config.get_config())

local config = vim.tbl_deep_extend("force", old_config, {
keymaps = {
view = {
["q"] = cb("close"),
["<esc>"] = cb("close"),
},
file_panel = {
["q"] = cb("close"),
["<esc>"] = cb("close"),
},
local config = dv_config.get_config()

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

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

dv.setup(config)

Expand All @@ -174,7 +178,6 @@ function M.open(section_name, item_name)
if view then
view:open()
end

return view
end

Expand Down

0 comments on commit 10eaae0

Please sign in to comment.