sindrets / diffview.nvim

Single tabpage interface for easily cycling through diffs for all modified files for any git rev.
Other
3.74k stars 105 forks source link

help panel crash #352

Closed sudo-tee closed 1 year ago

sudo-tee commented 1 year ago

When open DiffView and want to see the help panel with g?

I get the following error

E5108: Error executing lua: ...lazy/diffview.nvim/lua/diffview/ui/panels/help_panel.lua:147: attempt to index local 'a' (a nil value) stack traceback: ...lazy/diffview.nvim/lua/diffview/ui/panels/help_panel.lua:147: in function <...lazy/diffview.nvim/lua/diffview/ui/panels/help_panel.lua:144> [C]: in function 'sort' ...lazy/diffview.nvim/lua/diffview/ui/panels/help_panel.lua:144: in function 'update_components' .../share/nvim/lazy/diffview.nvim/lua/diffview/ui/panel.lua:377: in function 'init_buffer' ...lazy/diffview.nvim/lua/diffview/ui/panels/help_panel.lua:99: in function 'init_buffer' .../share/nvim/lazy/diffview.nvim/lua/diffview/ui/panel.lua:260: in function 'open' .../share/nvim/lazy/diffview.nvim/lua/diffview/ui/panel.lua:234: in function 'focus'

I am using LazyVim with the latest version

thanks for your help :)

sindrets commented 1 year ago

Please provide your diffview config.

sudo-tee commented 1 year ago

here it is

{
    "sindrets/diffview.nvim",
    branch = "main",
    cmd = { "DiffviewOpen", "DiffviewFileHistory" },
    keys = {
      { "<leader>gd", "<cmd>DiffviewOpen<CR>", desc = "Git Diff View" },
    },
    opts = function()
      local actions = require("diffview.actions")
      return {
        enhanced_diff_hl = true, -- See ':h diffview-config-enhanced_diff_hl'
        keymaps = {
          view = {
            { "n", "q", "<cmd>DiffviewClose<CR>" },
            { "n", "<Tab>", actions.select_next_entry },
            { "n", "<S-Tab>", actions.select_prev_entry },
            { "n", "<LocalLeader>a", actions.focus_files },
            { "n", "<LocalLeader>e", actions.toggle_files },
          },
          file_panel = {
            { "n", "q", "<cmd>DiffviewClose<CR>" },
            { "n", "h", actions.prev_entry },
            { "n", "o", actions.focus_entry },
            { "n", "gf", actions.goto_file },
            { "n", "sg", actions.goto_file_split },
            { "n", "st", actions.goto_file_tab },
            { "n", "<C-r>", actions.refresh_files },
            { "n", ";e", actions.toggle_files },
          },
          file_history_panel = {
            { "n", "q", "<cmd>DiffviewClose<CR>" },
            { "n", "o", actions.focus_entry },
            { "n", "O", actions.options },
          },
        },
      }
    end,
  },
sindrets commented 1 year ago

Thanks! Fixed in the latest commit.

sudo-tee commented 1 year ago

Wow thanks that was fast :D