remaster
This commit is contained in:
parent
1b949bdb01
commit
a90ea1f671
18 changed files with 1361 additions and 1210 deletions
63
lua/plugins/harpoon.lua
Normal file
63
lua/plugins/harpoon.lua
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
-- Harpoon for quick file navigation
|
||||
return {
|
||||
'ThePrimeagen/harpoon',
|
||||
branch = 'harpoon2',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
config = function()
|
||||
local harpoon = require 'harpoon'
|
||||
harpoon:setup()
|
||||
|
||||
vim.keymap.set('n', '<leader>A', function()
|
||||
harpoon:list():add()
|
||||
end, { desc = 'Add a file to harpoon' })
|
||||
vim.keymap.set('n', '<leader>a', function()
|
||||
harpoon.ui:toggle_quick_menu(harpoon:list())
|
||||
end, { desc = 'Open harpoon nav' })
|
||||
|
||||
vim.keymap.set('n', '<leader>1', function()
|
||||
harpoon:list():select(1)
|
||||
end, { desc = 'Go to file 1' })
|
||||
vim.keymap.set('n', '<leader>2', function()
|
||||
harpoon:list():select(2)
|
||||
end, { desc = 'Go to file 2' })
|
||||
vim.keymap.set('n', '<leader>3', function()
|
||||
harpoon:list():select(3)
|
||||
end, { desc = 'Go to file 3' })
|
||||
vim.keymap.set('n', '<leader>4', function()
|
||||
harpoon:list():select(4)
|
||||
end, { desc = 'Go to file 4' })
|
||||
vim.keymap.set('n', '<leader>5', function()
|
||||
harpoon:list():select(5)
|
||||
end, { desc = 'Go to file 5' })
|
||||
|
||||
vim.keymap.set('n', '<C-S-P>', function()
|
||||
harpoon:list():prev()
|
||||
end)
|
||||
vim.keymap.set('n', '<C-S-N>', function()
|
||||
harpoon:list():next()
|
||||
end)
|
||||
|
||||
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', '<leader>z', function()
|
||||
toggle_telescope(harpoon:list())
|
||||
end, { desc = 'Open harpoon window in telescope' })
|
||||
end,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue