2024-03-26 20:07:08 +00:00
|
|
|
return {
|
|
|
|
"ThePrimeagen/harpoon",
|
|
|
|
branch= "harpoon2",
|
2024-10-05 13:25:46 +00:00
|
|
|
dependencies = {
|
|
|
|
{"nvim-lua/plenary.nvim"},
|
|
|
|
{"nvim-telescope/telescope.nvim"}
|
|
|
|
},
|
2024-03-26 20:07:08 +00:00
|
|
|
config = function()
|
|
|
|
local harpoon = require("harpoon")
|
|
|
|
harpoon.setup()
|
|
|
|
|
2024-10-05 13:25:46 +00:00
|
|
|
local conf = require("telescope.config").values
|
|
|
|
local function toggle_telescope(harpoon_files)
|
|
|
|
local file_paths = {}
|
|
|
|
for _, item in ipairs(harpoon_files.items) do
|
|
|
|
table.insert(file_paths, item.value)
|
|
|
|
end
|
2024-03-26 20:07:08 +00:00
|
|
|
|
2024-10-05 13:25:46 +00:00
|
|
|
require("telescope.pickers").new({}, {
|
|
|
|
result = file_paths,
|
|
|
|
previewer = conf.file_previewer({}),
|
|
|
|
sorter = conf.generic_sorter({}),
|
|
|
|
}):find()
|
|
|
|
end
|
|
|
|
|
|
|
|
vim.keymap.set("n", "<leader>ha", function() harpoon:list():add() end)
|
|
|
|
vim.keymap.set("n", "<leader>hh", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
|
|
|
|
vim.keymap.set("n", "<leader>fe", function () toggle_telescope(harpoon:list()) end, { desc = "Open harpoon window"} )
|
|
|
|
vim.keymap.set("n", "C-1", function() harpoon:list():select(1) end)
|
|
|
|
vim.keymap.set("n", "C-2", function() harpoon:list():select(2) end)
|
|
|
|
vim.keymap.set("n", "C-3", function() harpoon:list():select(3) end)
|
|
|
|
vim.keymap.set("n", "C-4", function() harpoon:list():select(4) end)
|
2024-03-26 20:07:08 +00:00
|
|
|
|
|
|
|
|
2024-04-03 19:05:46 +00:00
|
|
|
vim.keymap.set("n", "<C-Q>", function() harpoon:list():prev() end)
|
|
|
|
vim.keymap.set("n", "<C-E>", function() harpoon:list():next() end)
|
2024-03-26 20:07:08 +00:00
|
|
|
|
|
|
|
end
|
|
|
|
}
|