Skip to content

Commit

Permalink
feat(harpoon): update to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
luxus authored Feb 11, 2024
1 parent b8e7c12 commit bf75529
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions lua/astrocommunity/motion/harpoon/init.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
local prefix = "<leader><leader>"
local harpoon = require("harpoon")
local term_string = vim.fn.exists "$TMUX" == 1 and "tmux" or "term"
local maps = { n = {} }
local icon = vim.g.icons_enabled and "󱡀 " or ""
Expand All @@ -15,37 +14,42 @@ return {
},
cmd = { "Harpoon" },
keys = {
{ prefix .. "a", function() harpoon:list():append() end, desc = "Add file" },
{ prefix .. "e", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end, desc = "Toggle quick menu" },
{ prefix .. "a", function() require("harpoon"):list():append() end, desc = "Add file" },
{
prefix .. "e",
function() require("harpoon").ui:toggle_quick_menu(require("harpoon"):list()) end,
desc = "Toggle quick menu",
},
{
"<C-x>",
function()
vim.ui.input({ prompt = "Harpoon mark index: " }, function(input)
local num = tonumber(input)
if num then harpoon:list():select(num) end
if num then require("harpoon"):list():select(num) end
end)
end,
desc = "Goto index of mark",
},
{ "<C-p>", function() harpoon:list():prev() end, desc = "Goto previous mark" },
{ "<C-n>", function() harpoon:list():next() end, desc = "Goto next mark" },
{ "<C-p>", function() require("harpoon"):list():prev() end, desc = "Goto previous mark" },
{ "<C-n>", function() require("harpoon"):list():next() end, desc = "Goto next mark" },
{ prefix .. "m", "<cmd>Telescope harpoon marks<CR>", desc = "Show marks in Telescope" },
{
prefix .. "t",
function()
vim.ui.input({ prompt = term_string .. " window number: " }, function(input)
local num = tonumber(input)
if num then harpoon.term.gotoTerminal(num) end
if num then require("harpoon").term.gotoTerminal(num) end
end)
end,
desc = "Go to " .. term_string .. " window",
},
},
opts = {}
},
{
"catppuccin/nvim",
optional = true,
---@type CatppuccinOptions
opts = { integrations = { harpoon = true } },
},
}
}

0 comments on commit bf75529

Please sign in to comment.