summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/config/plugins/harpoon.lua
blob: 25168cc6567983cefff9f441a24fd10006cb30cd (plain)
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
45
46
47
48
49
return {
  "https://github.com/theprimeagen/harpoon",
  branch = "harpoon2",
  event = "VeryLazy",
  config = function()
    local harpoon = require("harpoon")
    harpoon.setup({
      settings = {
        save_on_toggle = true,
        sync_on_ui_close = true,
        key = function()
          return vim.fn.getcwd()
        end,
      },
    })
    harpoon:setup()

    local list = harpoon:list("default")
    local wk = require("which-key")

    wk.add({
      mode = { "n" },
      {
        "<leader>a",
        function()
          list:add()
        end,
        hidden = true,
      },
      {
        "<leader><leader>",
        function()
          harpoon.ui:toggle_quick_menu(list)
        end,
        hidden = true,
      },
    })
    for i = 1, 6 do
      wk.add({
        "<leader>" .. i,
        function()
          list:select(i)
        end,
        hidden = true,
        mode = "n",
      })
    end
  end,
}