mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-01-26 11:14:08 +00:00
104 lines
2.5 KiB
Lua
104 lines
2.5 KiB
Lua
return {
|
|
-- Getting you where you want with the fewest keystrokes.
|
|
-- https://github.com/ThePrimeagen/harpoon
|
|
{
|
|
'ThePrimeagen/harpoon',
|
|
branch = 'harpoon2',
|
|
dependencies = {
|
|
'nvim-lua/plenary.nvim',
|
|
'nvim-telescope/telescope.nvim',
|
|
},
|
|
config = function()
|
|
local harpoon = require 'harpoon'
|
|
|
|
harpoon:setup {}
|
|
|
|
vim.keymap.set('n', '<leader>ht', function()
|
|
harpoon.ui:toggle_quick_menu(harpoon:list())
|
|
end, { desc = 'Open Harpoon Quick menu' })
|
|
|
|
-- 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', '<leader>hw', function()
|
|
toggle_telescope(harpoon:list())
|
|
end, { desc = 'Open harpoon window with telescope' })
|
|
end,
|
|
keys = {
|
|
{
|
|
'<leader>ha',
|
|
function()
|
|
require('harpoon'):list():add()
|
|
end,
|
|
desc = 'harpoon file',
|
|
},
|
|
{
|
|
'<leader>hp',
|
|
function()
|
|
require('harpoon'):list():prev()
|
|
end,
|
|
desc = 'harpoon to previous file',
|
|
},
|
|
{
|
|
'<leader>hn',
|
|
function()
|
|
require('harpoon'):list():next()
|
|
end,
|
|
desc = 'harpoon to next file',
|
|
},
|
|
{
|
|
'<leader>1',
|
|
function()
|
|
require('harpoon'):list():select(1)
|
|
end,
|
|
desc = 'harpoon to file 1',
|
|
},
|
|
{
|
|
'<leader>2',
|
|
function()
|
|
require('harpoon'):list():select(2)
|
|
end,
|
|
desc = 'harpoon to file 2',
|
|
},
|
|
{
|
|
'<leader>3',
|
|
function()
|
|
require('harpoon'):list():select(3)
|
|
end,
|
|
desc = 'harpoon to file 3',
|
|
},
|
|
{
|
|
'<leader>4',
|
|
function()
|
|
require('harpoon'):list():select(4)
|
|
end,
|
|
desc = 'harpoon to file 4',
|
|
},
|
|
{
|
|
'<leader>5',
|
|
function()
|
|
require('harpoon'):list():select(5)
|
|
end,
|
|
desc = 'harpoon to file 5',
|
|
},
|
|
},
|
|
},
|
|
}
|