added plugins
This commit is contained in:
parent
2ba39c6973
commit
83cf11d0ad
13 changed files with 338 additions and 0 deletions
66
lua/custom/plugins/harpoon.lua
Normal file
66
lua/custom/plugins/harpoon.lua
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
return {
|
||||
'ThePrimeagen/harpoon',
|
||||
branch = 'harpoon2',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
opts = 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
|
||||
|
||||
vim.keymap.set('n', '<C-e>', function()
|
||||
toggle_telescope(harpoon:list())
|
||||
end, { desc = 'Open harpoon window' })
|
||||
local harpoon = require 'harpoon'
|
||||
|
||||
vim.keymap.set('n', '<leader>ah', function()
|
||||
harpoon:list():add()
|
||||
end, { desc = '[A]dd to [H]arpoon list' })
|
||||
|
||||
-- vim.keymap.set('n', '<C-e>', function()
|
||||
-- harpoon.ui:toggle_quick_menu(harpoon:list())
|
||||
-- end)
|
||||
|
||||
vim.keymap.set('n', '<C-1>', function()
|
||||
harpoon:list():select(1)
|
||||
end)
|
||||
vim.keymap.set('n', '<C-2>', function()
|
||||
harpoon:list():select(2)
|
||||
end)
|
||||
vim.keymap.set('n', '<C-3>', function()
|
||||
harpoon:list():select(3)
|
||||
end)
|
||||
vim.keymap.set('n', '<C-4>', function()
|
||||
harpoon:list():select(4)
|
||||
end)
|
||||
|
||||
-- Toggle previous & next buffers stored within Harpoon list
|
||||
vim.keymap.set('n', '<A-h>', function()
|
||||
harpoon:list():prev()
|
||||
end)
|
||||
vim.keymap.set('n', '<A-l>', function()
|
||||
harpoon:list():next()
|
||||
end)
|
||||
vim.keymap.set('n', '<C-x>', function()
|
||||
harpoon:list():remove()
|
||||
end)
|
||||
end,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue