mirror of
https://github.com/LazyVim/starter.git
synced 2026-07-24 05:21:04 +00:00
Telescope harpoon files
This commit is contained in:
parent
dbb97de380
commit
8697939562
1 changed files with 33 additions and 0 deletions
|
|
@ -9,6 +9,10 @@ return {
|
||||||
save_on_toggle = true,
|
save_on_toggle = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
},
|
||||||
keys = function()
|
keys = function()
|
||||||
local keys = {
|
local keys = {
|
||||||
{
|
{
|
||||||
|
|
@ -39,4 +43,33 @@ return {
|
||||||
end
|
end
|
||||||
return keys
|
return keys
|
||||||
end,
|
end,
|
||||||
|
config = function()
|
||||||
|
local harpoon = require("harpoon")
|
||||||
|
harpoon:setup({})
|
||||||
|
|
||||||
|
-- basic telescope configuration
|
||||||
|
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
|
||||||
|
|
||||||
|
require("telescope.pickers")
|
||||||
|
.new({}, {
|
||||||
|
prompt_title = "Harpoon",
|
||||||
|
finder = require("telescope.finders").new_table({
|
||||||
|
results = file_paths,
|
||||||
|
}),
|
||||||
|
previewer = conf.file_previewer({}),
|
||||||
|
sorter = conf.generic_sorter({}),
|
||||||
|
})
|
||||||
|
:find()
|
||||||
|
end
|
||||||
|
|
||||||
|
local set = LazyVim.safe_keymap_set
|
||||||
|
set("n", "<C-e>", function()
|
||||||
|
toggle_telescope(harpoon:list())
|
||||||
|
end, { desc = "Open harpoon window" })
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue