summaryrefslogtreecommitdiffstats
path: root/lua/conf/plugins/harpoon.lua
blob: b4b23306883b961c5332a310e664d49ef6dfecf5 (plain) (blame)
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
local misc = require("core.misc")
local map = misc.map

return { "ThePrimeagen/harpoon",
  disable = not vim.fn.has("nvim-0.8.0"),
  commit = "e76cb03",
  branch = "harpoon2",
  requires = "nvim-lua/plenary.nvim",
  function()
    local harpoon = require("harpoon")

    harpoon:setup()

    map("n", "<leader>a", function()
      harpoon:list():add()
      vim.notify("added "..vim.fn.expand("%:t").." to quickmarks", vim.log.levels.INFO, {
        title = misc.appid
      })
    end, { desc = "add current file to quickmarks" })

    map("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)

    map("n", "<C-h>", function() harpoon:list():select(1) end)
    map("n", "<C-t>", function() harpoon:list():select(2) end)
    map("n", "<C-n>", function() harpoon:list():select(3) end)
    map("n", "<C-c>", function() harpoon:list():select(4) end)

    -- Toggle previous & next buffers stored within Harpoon list
    map("n", "<C-S-P>", function() harpoon:list():prev() end)
    map("n", "<C-S-N>", function() harpoon:list():next() end)
  end
}