diff options
Diffstat (limited to 'lua/core/harpoon.lua')
-rw-r--r-- | lua/core/harpoon.lua | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lua/core/harpoon.lua b/lua/core/harpoon.lua index 4d20828..ce68bdd 100644 --- a/lua/core/harpoon.lua +++ b/lua/core/harpoon.lua @@ -28,21 +28,25 @@ function M.switcher() end) -- remove harpoon item - -- TODO: - - -- select items, and open buffer - vim.keymap.set("n", "<C-v>", function() + vim.keymap.set("i", "<C-a>", function() if action_state.get_selected_entry() then - actions.close(prompt_bufnr) - vim.cmd("vsplit "..action_state.get_selected_entry()[1]) + for i, v in ipairs(filepaths) do + if v == action_state.get_selected_entry()[1] then + harpoon:list():removeAt(i) + actions.close(prompt_bufnr) + M.switcher() + end + end end end) - vim.keymap.set({ "n", "i" }, "<C-s>", function() + + -- select items, and open buffer + vim.keymap.set("i", "<C-s>", function() if action_state.get_selected_entry() then actions.close(prompt_bufnr) vim.cmd("split "..action_state.get_selected_entry()[1]) end - end) + end, { buffer = true, remap = true }) actions.select_default:replace(function() if action_state.get_selected_entry() then actions.close(prompt_bufnr) |