From bf7552952edfbdd023a2a9df8fe9625a98cd9c95 Mon Sep 17 00:00:00 2001 From: luxus Date: Sun, 11 Feb 2024 19:08:28 +0100 Subject: [PATCH] feat(harpoon): update to v2 --- lua/astrocommunity/motion/harpoon/init.lua | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lua/astrocommunity/motion/harpoon/init.lua b/lua/astrocommunity/motion/harpoon/init.lua index 185f2579c..dd17ab308 100644 --- a/lua/astrocommunity/motion/harpoon/init.lua +++ b/lua/astrocommunity/motion/harpoon/init.lua @@ -1,5 +1,4 @@ local prefix = "" -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 "" @@ -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", + }, { "", 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", }, - { "", function() harpoon:list():prev() end, desc = "Goto previous mark" }, - { "", function() harpoon:list():next() end, desc = "Goto next mark" }, + { "", function() require("harpoon"):list():prev() end, desc = "Goto previous mark" }, + { "", function() require("harpoon"):list():next() end, desc = "Goto next mark" }, { prefix .. "m", "Telescope harpoon marks", 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 } }, - }, + } }