Skip to content

Commit

Permalink
Updated harpoon config
Browse files Browse the repository at this point in the history
- Included a function that removes files from harpoon buffers

based on the following issue:
ThePrimeagen/harpoon#499
  • Loading branch information
FKouhai committed Oct 12, 2024
1 parent 2565029 commit 9d93548
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions nvim/lua/plugins/harpoon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,31 @@ return {
harpoon.setup({})
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)
local finder = function()
local file_paths = {}
for _,item in ipairs(harpoon_files.items)do
table.insert(file_paths,item.value)
end
return require("telescope.finders").new_table({
results = file_paths,
})
end
require("telescope.pickers").new({}, {

require("telescope.pickers").new({}, {
prompt_title = "Harpoon",
finder = require("telescope.finders").new_table({
results = file_paths,
}),
finder = finder(),
previewer = conf.file_previewer({}),
sorter = conf.generic_sorter({}),
attach_mappings = function(prompt_bufnr, map)
map("i", "<C-d>", function ()
local state = require("telescope.actions.state")
local selected_entry = state.get_selected_entry()
local current_picker = state.get_current_picker(prompt_bufnr)
table.remove(harpoon_files.items, selected_entry.index)
current_picker:refresh(finder())
end)
return true
end,
}):find()
end
vim.keymap.set("n", "<leader>a", function() harpoon:list():add() end)
Expand Down

0 comments on commit 9d93548

Please sign in to comment.