From 98a1570fc3d5593e5c862fe72043d9faa3e2eade Mon Sep 17 00:00:00 2001 From: Jimmy Bates Date: Sun, 30 Jun 2024 15:50:49 -0700 Subject: [PATCH] Updated harpoon to harpoon v2 --- lua/custom/plugins/harpoon.lua | 75 ++++++++++++++++++++++++++++++---- 1 file changed, 66 insertions(+), 9 deletions(-) diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua index 4a0bd3d0..99285d4d 100644 --- a/lua/custom/plugins/harpoon.lua +++ b/lua/custom/plugins/harpoon.lua @@ -1,18 +1,75 @@ return { 'ThePrimeagen/harpoon', lazy = false, + branch = 'harpoon2', dependencies = { 'nvim-lua/plenary.nvim', }, - config = true, + config = function() + require('harpoon'):setup() + end, keys = { - { '', "lua require('harpoon.mark').add_file()", desc = 'Mark file with harpoon' }, - { '', "lua require('harpoon.ui').nav_next()", desc = 'Go to next harpoon mark' }, - { '', "lua require('harpoon.ui').nav_prev()", desc = 'Go to previous harpoon mark' }, - { '', "lua require('harpoon.ui').toggle_quick_menu()", desc = 'Show harpoon marks' }, - { 'om', "lua require('harpoon.mark').add_file()", desc = 'Mark file with harpoon' }, - { 'o[', "lua require('harpoon.ui').nav_next()", desc = 'Go to next harpoon mark' }, - { 'o]', "lua require('harpoon.ui').nav_prev()", desc = 'Go to previous harpoon mark' }, - { 'oo', "lua require('harpoon.ui').toggle_quick_menu()", desc = 'Show harpoon marks' }, + { + '', + function() + require('harpoon'):list():add() + end, + desc = 'Mark file with harpoon', + }, + { + '', + function() + require('harpoon'):list():next() + end, + desc = 'Go to next harpoon mark', + }, + { + '', + function() + require('harpoon'):list():prev() + end, + desc = 'Go to previous harpoon mark', + }, + { + '', + function() + local harpoon = require 'harpoon' + harpoon.ui:toggle_quick_menu(require('harpoon'):list()) + end, + desc = 'Show harpoon marks', + }, + { + 'om', + function() + require('harpoon'):list():add() + end, + desc = 'Mark file with harpoon', + }, + { + 'o[', + function() + require('harpoon'):list():next() + end, + desc = 'Go to next harpoon mark', + }, + { + 'o]', + function() + require('harpoon'):list():prev() + end, + desc = 'Go to previous harpoon mark', + }, + { + 'oo', + function() + local harpoon = require 'harpoon' + harpoon.ui:toggle_quick_menu(require('harpoon'):list()) + end, + desc = 'Show harpoon marks', + }, }, } + +-- Good example of converting commands from normal VIM setup to lazy setup: +-- https://github.com/ThePrimeagen/harpoon/tree/harpoon2 +-- https://www.reddit.com/r/neovim/comments/18as0nm/harpoon2_branch_lazy_vim_setup