From df5f771f07c19efd378d91c8e5d96f3c92495dc3 Mon Sep 17 00:00:00 2001 From: jasmine Date: Tue, 24 Jun 2025 20:51:02 +0800 Subject: [PATCH] install and setup harpoon --- config/default.nix | 1 + config/plugins/editor/harpoon.nix | 112 ++++++++++++++++++++++++++++++ config/plugins/git/gitsigns.nix | 20 ------ 3 files changed, 113 insertions(+), 20 deletions(-) create mode 100644 config/plugins/editor/harpoon.nix diff --git a/config/default.nix b/config/default.nix index 98a962d..848ef95 100644 --- a/config/default.nix +++ b/config/default.nix @@ -20,6 +20,7 @@ # Editor plugins and configurations ./plugins/editor/buffers.nix ./plugins/editor/commentary.nix + ./plugins/editor/harpoon.nix ./plugins/editor/mini.nix ./plugins/editor/sessions.nix ./plugins/editor/smart-splits.nix diff --git a/config/plugins/editor/harpoon.nix b/config/plugins/editor/harpoon.nix new file mode 100644 index 0000000..a3b9d35 --- /dev/null +++ b/config/plugins/editor/harpoon.nix @@ -0,0 +1,112 @@ +{pkgs, ...}:{ + plugins.harpoon = { + enable = true; + }; + + keymaps = [ + { + mode = ["n"]; + key = "h"; + action = ""; + options = { + desc = "+harpoon"; + }; + } + + { + mode = ["n"]; + key = "ha"; + action = { + __raw = "function() require'harpoon':list():add() end"; + }; + options = { + desc = "Harpoon Add"; + silent = true; + }; + } + + { + mode = ["n"]; + key = "]h"; + action = { + __raw = "function() require'harpoon':list():next() end"; + }; + options = { + desc = "Harpoon Next Mark"; + silent = true; + }; + } + + { + mode = ["n"]; + key = "[h"; + action = { + __raw = "function() require'harpoon':list():prev() end"; + }; + options = { + desc = "Harpoon Previous Mark"; + silent = true; + }; + } + + { + mode = ["n"]; + key = "h1"; + action = { + __raw = "function() require'harpoon':list():select(1) end"; + }; + options = { + desc = "Harpoon Mark 1"; + silent = true; + }; + } + + { + mode = ["n"]; + key = "h2"; + action = { + __raw = "function() require'harpoon':list():select(2) end"; + }; + options = { + desc = "Harpoon Mark 2"; + silent = true; + }; + } + + { + mode = ["n"]; + key = "h3"; + action = { + __raw = "function() require'harpoon':list():select(3) end"; + }; + options = { + desc = "Harpoon Mark 3"; + silent = true; + }; + } + + { + mode = ["n"]; + key = "h4"; + action = { + __raw = "function() require'harpoon':list():select(4) end"; + }; + options = { + desc = "Harpoon Mark 4"; + silent = true; + }; + } + + { + mode = ["n"]; + key = "hm"; + action = { + __raw = "function() require'harpoon'.ui:toggle_quick_menu(require'harpoon':list()) end"; + }; + options = { + desc = "Harpoon Menu"; + silent = true; + }; + } + ]; +} diff --git a/config/plugins/git/gitsigns.nix b/config/plugins/git/gitsigns.nix index 1ad36e3..0f363af 100644 --- a/config/plugins/git/gitsigns.nix +++ b/config/plugins/git/gitsigns.nix @@ -63,25 +63,5 @@ desc = "View Blame"; }; } - - { - mode = ["n"]; - key = "[h"; - action = "Gitsigns prev_hunk"; - options = { - silent = true; - desc = "Goto Previous Hunk"; - }; - } - - { - mode = ["n"]; - key = "]h"; - action = "Gitsigns next_hunk"; - options = { - silent = true; - desc = "Goto Next Hunk"; - }; - } ]; }