diff --git a/lazy-lock.json b/lazy-lock.json index 7227e46..9d10e90 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -6,6 +6,7 @@ "conform.nvim": { "branch": "master", "commit": "c2526f1cde528a66e086ab1668e996d162c75f4f" }, "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, "gitsigns.nvim": { "branch": "main", "commit": "31217271a7314c343606acb4072a94a039a19fb5" }, + "harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, diff --git a/lua/plugins/harpoon.lua b/lua/plugins/harpoon.lua new file mode 100644 index 0000000..bd63bde --- /dev/null +++ b/lua/plugins/harpoon.lua @@ -0,0 +1,52 @@ +return { + { + "ThePrimeagen/harpoon", + branch = "harpoon2", -- IMPORTANT: use maintained version + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + local harpoon = require("harpoon") + harpoon:setup() + + -- Add current file + vim.keymap.set("n", "ha", function() + harpoon:list():add() + end, { desc = "Harpoon add file" }) + + -- Toggle quick menu + vim.keymap.set("n", "hm", function() + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, { desc = "Harpoon menu" }) + + -- Remove current file from harpoon + vim.keymap.set("n", "hr", function() + require("harpoon"):list():remove() + end, { desc = "Harpoon: remove file" }) + + -- Jump to files + vim.keymap.set("n", "1", function() + harpoon:list():select(1) + end) + + vim.keymap.set("n", "2", function() + harpoon:list():select(2) + end) + + vim.keymap.set("n", "3", function() + harpoon:list():select(3) + end) + + vim.keymap.set("n", "4", function() + harpoon:list():select(4) + end) + + -- Optional: cycle + vim.keymap.set("n", "", function() + harpoon:list():prev() + end) + + vim.keymap.set("n", "", function() + harpoon:list():next() + end) + end, + }, +}