Add harpoon2 to neovim config

Add Harpoon2 plugin to Neovim configuration and integrate it with Telescope and Which-Key.

* Add `ThePrimeagen/harpoon` plugin to `lua/custom/plugins/init.lua` with branch `harpoon2` and configure it.
* Add keybindings for Harpoon commands in `init.lua`.
* Integrate Harpoon with Telescope by creating a custom picker for Harpoon marks and adding keybindings to open the custom picker.
* Integrate Harpoon with Which-Key by adding commands to the Which-Key menu and creating keybindings for adding, navigating, and removing Harpoon marks.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/sebbii17/kickstart.nvim?shareId=XXXX-XXXX-XXXX-XXXX).
This commit is contained in:
Sebastian 2024-12-14 10:13:30 +01:00
parent 268b0b46c2
commit 65bab0bb73
2 changed files with 22 additions and 0 deletions

View File

@ -321,6 +321,7 @@ require('lazy').setup({
{ '<leader>w', group = '[W]orkspace' },
{ '<leader>t', group = '[T]oggle' },
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
{ '<leader>m', group = '[M]arks' },
},
},
},
@ -434,6 +435,9 @@ require('lazy').setup({
vim.keymap.set('n', '<leader>sn', function()
builtin.find_files { cwd = vim.fn.stdpath 'config' }
end, { desc = '[S]earch [N]eovim files' })
-- Custom picker for Harpoon marks
vim.keymap.set('n', '<leader>sm', require('harpoon.ui').toggle_quick_menu, { desc = '[S]earch [M]arks' })
end,
},
@ -1008,5 +1012,12 @@ require('lazy').setup({
},
})
-- Harpoon keybindings
vim.keymap.set('n', '<leader>ma', require('harpoon.mark').add_file, { desc = '[M]ark [A]dd file' })
vim.keymap.set('n', '<leader>mm', require('harpoon.ui').toggle_quick_menu, { desc = '[M]ark [M]enu' })
vim.keymap.set('n', '<leader>mn', require('harpoon.ui').nav_next, { desc = '[M]ark [N]ext' })
vim.keymap.set('n', '<leader>mp', require('harpoon.ui').nav_prev, { desc = '[M]ark [P]revious' })
vim.keymap.set('n', '<leader>md', require('harpoon.mark').rm_file, { desc = '[M]ark [D]elete file' })
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

View File

@ -15,4 +15,15 @@ return {
opts = {},
dependencies = { 'nvim-tree/nvim-web-devicons' }, -- use if prefer nvim-web-devicons
},
{
'ThePrimeagen/harpoon',
branch = 'harpoon2',
config = function()
require('harpoon').setup({
menu = {
width = vim.api.nvim_win_get_width(0) - 4,
}
})
end,
},
}