diff --git a/nix/base-system/flake.lock b/nix/base-system/flake.lock index 38c7506..ca9d15a 100644 --- a/nix/base-system/flake.lock +++ b/nix/base-system/flake.lock @@ -48,7 +48,9 @@ "inputs": { "d2-vim-src": "d2-vim-src", "flake-utils": "flake-utils_3", + "hunk-nvim-src": "hunk-nvim-src", "ionide-nvim-src": "ionide-nvim-src", + "naersk": "naersk_2", "neogit-src": "neogit-src", "nil-flake": "nil-flake", "nixpkgs": [ @@ -541,6 +543,22 @@ "type": "github" } }, + "hunk-nvim-src": { + "flake": false, + "locked": { + "lastModified": 1726776875, + "narHash": "sha256-CbvfRmgVshzEH/EUn1/PfNzT+MChtTTmxfi+gTZ7Q6Y=", + "owner": "julienvincent", + "repo": "hunk.nvim", + "rev": "eb89245a66bdfce10436d15923bf4deb43d23c96", + "type": "github" + }, + "original": { + "owner": "julienvincent", + "repo": "hunk.nvim", + "type": "github" + } + }, "ionide-nvim-src": { "flake": false, "locked": { diff --git a/nix/base-system/flake.nix b/nix/base-system/flake.nix index 0c347ba..8fa2296 100644 --- a/nix/base-system/flake.nix +++ b/nix/base-system/flake.nix @@ -98,6 +98,7 @@ }; neogit-nvim = custom-flakes.packages."${system}".neogit-nvim; d2-vim = custom-flakes.packages."${system}".d2-vim; + hunk-nvim = custom-flakes.packages."${system}".hunk-nvim; # TODO(zaphar): Apparently this is a remote plugin so it needs some additional love. #nvim-bnf = custom-flakes.packages."${system}".nvim-bnf; nvim-treesitter-context = custom-flakes.packages."${system}".nvim-treesitter-context; @@ -204,7 +205,7 @@ EOF"; vim-dadbod-completion vim-dasht direnv-vim - ]) ++ [ possession-nvim harpoon-nvim d2-vim neogit-nvim ]; + ]) ++ [ possession-nvim harpoon-nvim d2-vim hunk-nvim neogit-nvim ]; }; }; }; diff --git a/nix/base-system/init.lua b/nix/base-system/init.lua index d4f9c71..a58df28 100644 --- a/nix/base-system/init.lua +++ b/nix/base-system/init.lua @@ -577,6 +577,59 @@ require('lualine').setup { } } +-- Hunk diff tree viewer and editor. Replacement for Meld and company +local hunk = require("hunk") +hunk.setup({ + keys = { + global = { + quit = { "q" }, + accept = { "" }, + focus_tree = { "e" }, + }, + + tree = { + expand_node = { "l", "" }, + collapse_node = { "h", "" }, + + open_file = { "" }, + + toggle_file = { "a" }, + }, + + diff = { + toggle_line = { "a" }, + toggle_hunk = { "A" }, + }, + }, + + ui = { + tree = { + -- Mode can either be `nested` or `flat` + mode = "nested", + width = 35, + }, + --- Can be either `vertical` or `horizontal` + layout = "vertical", + }, + + icons = { + selected = "󰡖", + deselected = "", + partially_selected = "󰛲", + + folder_open = "", + folder_closed = "", + }, + + -- Called right after each window and buffer are created. + --hooks = { + -- ---@param _context { buf: number, tree: NuiTree, opts: table } + -- on_tree_mount = function(_context) end, + -- ---@param _context { buf: number, win: number } + -- on_diff_mount = function(_context) end, + --}, +}) + local dap = require('dap') dap.adapters.lldb = { type = "executable",