mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 01:50:27 +00:00
Added telescope support
This commit is contained in:
parent
3170133737
commit
e785919c04
31
README.md
31
README.md
@ -79,6 +79,37 @@ vim.keymap.set("n", "<C-S-P>", function() harpoon:list():prev() end)
|
|||||||
vim.keymap.set("n", "<C-S-N>", function() harpoon:list():next() end)
|
vim.keymap.set("n", "<C-S-N>", function() harpoon:list():next() end)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Telescope
|
||||||
|
|
||||||
|
In order to use [Telescope](https://github.com/nvim-telescope/telescope.nvim) as a UI,
|
||||||
|
make sure to add `telescope` to your dependencies and paste this following snippet into your configuration.
|
||||||
|
|
||||||
|
```lua
|
||||||
|
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
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<C-e>", function() toggle_telescope(harpoon:list()) end,
|
||||||
|
{ desc = "Open harpoon window" })
|
||||||
|
```
|
||||||
|
|
||||||
## ⇁ API
|
## ⇁ API
|
||||||
You can define custom behavior of a harpoon list by providing your own calls.
|
You can define custom behavior of a harpoon list by providing your own calls.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user