Skip to content

Commit

Permalink
fix(harpoon): Update to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
luxus authored Jan 29, 2024
1 parent f39e1d4 commit b8e7c12
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lua/astrocommunity/motion/harpoon/init.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
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 @@ -7,33 +8,34 @@ require("astronvim.utils").set_mappings(maps)
return {
{
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
},
cmd = { "Harpoon" },
keys = {
{ prefix .. "a", function() require("harpoon.mark").add_file() end, desc = "Add file" },
{ prefix .. "e", function() require("harpoon.ui").toggle_quick_menu() end, desc = "Toggle quick menu" },
{ 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" },
{
"<C-x>",
function()
vim.ui.input({ prompt = "Harpoon mark index: " }, function(input)
local num = tonumber(input)
if num then require("harpoon.ui").nav_file(num) end
if num then harpoon:list():select(num) end
end)
end,
desc = "Goto index of mark",
},
{ "<C-p>", function() require("harpoon.ui").nav_prev() end, desc = "Goto previous mark" },
{ "<C-n>", function() require("harpoon.ui").nav_next() end, desc = "Goto next mark" },
{ "<C-p>", function() harpoon:list():prev() end, desc = "Goto previous mark" },
{ "<C-n>", function() 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 require("harpoon." .. term_string).gotoTerminal(num) end
if num then harpoon.term.gotoTerminal(num) end
end)
end,
desc = "Go to " .. term_string .. " window",
Expand Down

0 comments on commit b8e7c12

Please sign in to comment.