-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathharpoon.lua
44 lines (38 loc) · 1.38 KB
/
harpoon.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
return {
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = {
"nvim-lua/plenary.nvim",
},
config = function()
local harpoon = require("harpoon")
harpoon:setup({
settings = {
save_on_toggle = true,
sync_on_ui_close = true,
},
})
vim.keymap.set("n", "<leader>hm", function()
harpoon:list():add()
end, { desc = "[H]arpoon [M]ark" })
vim.keymap.set("n", "<leader>hv", function()
harpoon.ui:toggle_quick_menu(harpoon:list())
end, { desc = "[H]arpoon [V]iew quick menu" })
vim.keymap.set(
"n",
"<leader>hs",
":Telescope harpoon marks<cr>",
{ silent = true, desc = "[H]arpoon [S]earch with telescope" }
)
-- set up numeric keymaps: <leader>h1-9 for jumping to marks
for i = 1, 9 do
vim.keymap.set("n", "<leader>h" .. tostring(i), function()
harpoon:list():select(i)
end, { desc = "[H]arpoon jump to mark #" .. tostring(i) })
vim.keymap.set("n", "<leader>hh" .. tostring(i), function()
harpoon:list():select(i)
vim.cmd("ClangdSwitchSourceHeader")
end, { desc = "[H]arpoon [H]eader jump to mark #" .. tostring(i) .. " - meant for cpp files" })
end
end,
}