From dbb97de380250e1695ece93efc011a208511b260 Mon Sep 17 00:00:00 2001 From: Marcelo Jacobus Date: Fri, 14 Mar 2025 10:11:09 -0300 Subject: [PATCH] Config harpoon myself --- lua/config/lazy.lua | 2 +- lua/plugins/harpoon.lua | 42 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 lua/plugins/harpoon.lua diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index ea2eff2..e83b88d 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -38,7 +38,7 @@ local plugins = { { import = "lazyvim.plugins.extras.ui.treesitter-context" }, { import = "lazyvim.plugins.extras.editor.telescope" }, - { import = "lazyvim.plugins.extras.editor.harpoon2" }, + -- { import = "lazyvim.plugins.extras.editor.harpoon2" }, { import = "lazyvim.plugins.extras.editor.refactoring" }, { import = "lazyvim.plugins.extras.editor.aerial" }, -- ss list constants { import = "lazyvim.plugins.extras.editor.dial" }, -- like speadating diff --git a/lua/plugins/harpoon.lua b/lua/plugins/harpoon.lua new file mode 100644 index 0000000..699c254 --- /dev/null +++ b/lua/plugins/harpoon.lua @@ -0,0 +1,42 @@ +return { + "ThePrimeagen/harpoon", + branch = "harpoon2", + opts = { + menu = { + width = vim.api.nvim_win_get_width(0) - 4, + }, + settings = { + save_on_toggle = true, + }, + }, + keys = function() + local keys = { + { + "H", + function() + require("harpoon"):list():add() + end, + desc = "Harpoon File", + }, + { + "h", + function() + local harpoon = require("harpoon") + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, + desc = "Harpoon Quick Menu", + }, + } + + for i = 1, 9 do + table.insert(keys, { + "" .. i, + function() + require("harpoon"):list():select(i) + end, + desc = "Harpoon to File " .. i, + }) + end + return keys + end, +}