mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-13 17:40:25 +00:00
Merge pull request #442 from dormunis/harpoon2
Added telescope section in README
This commit is contained in:
commit
fe85b14a85
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)
|
||||
```
|
||||
|
||||
### 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
|
||||
You can define custom behavior of a harpoon list by providing your own calls.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user