From b35041ab69fb42d45e76fba6d8de1be26fd6f906 Mon Sep 17 00:00:00 2001 From: Nick Burt Date: Mon, 5 Feb 2024 12:52:19 -0600 Subject: [PATCH] install and configure harpoon --- lua/plugins/catpuccin.lua | 1 + lua/plugins/harpoon.lua | 52 +++++++++++++++++++++++++++++++++++++++ lua/plugins/oil.lua | 2 +- lua/plugins/whichkey.lua | 1 + 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 lua/plugins/harpoon.lua diff --git a/lua/plugins/catpuccin.lua b/lua/plugins/catpuccin.lua index 65a9c885..4e7767b5 100644 --- a/lua/plugins/catpuccin.lua +++ b/lua/plugins/catpuccin.lua @@ -14,6 +14,7 @@ return { integrations = { cmp = true, gitsigns = true, + harpoon = true, mason = true, telescope = true, treesitter = true, diff --git a/lua/plugins/harpoon.lua b/lua/plugins/harpoon.lua new file mode 100644 index 00000000..38a16cfc --- /dev/null +++ b/lua/plugins/harpoon.lua @@ -0,0 +1,52 @@ +-- tag and quickly switch between buffers +return { + 'thePrimeagen/harpoon', + config = function() + local harpoon_mark = require('harpoon.mark') + local harpoon_ui = require("harpoon.ui") + + vim.keymap.set('n', 'ho', function() + harpoon_ui.toggle_quick_menu() + end, { desc = '[O]pen [H]arpoon' }) + + vim.keymap.set('n', 'ha', function() + harpoon_mark.add_file() + end, { desc = '[A]dd [H]arpoon file' }) + + vim.keymap.set('n', 'hr', function() + harpoon_mark.rm_file() + end, { desc = '[R]emove [H]arpoon file' }) + + vim.keymap.set('n', 'hc', function() + harpoon_mark.clear_all() + end, { desc = '[C]lear [H]arpoon files' }) + + vim.keymap.set('n', 'hl', function() + harpoon_ui.nav_next() + end, { desc = 'Next [H]arpoon file' }) + + vim.keymap.set('n', 'hh', function() + harpoon_ui.nav_prev() + end, { desc = 'Previous [H]arpoon file' }) + + vim.keymap.set('n', '1', function() + harpoon_ui.nav_file(1) + end, { desc = 'Navigate to file [1]' }) + + vim.keymap.set('n', '2', function() + harpoon_ui.nav_file(2) + end, { desc = 'Navigate to file [2]' }) + + vim.keymap.set('n', '3', function() + harpoon_ui.nav_file(3) + end, { desc = 'Navigate to file [3]' }) + + vim.keymap.set('n', '4', function() + harpoon_ui.nav_file(4) + end, { desc = 'Navigate to file [4]' }) + + vim.keymap.set('n', '5', function() + harpoon_ui.nav_file(5) + end, { desc = 'Navigate to file [5]' }) + end +} diff --git a/lua/plugins/oil.lua b/lua/plugins/oil.lua index 52174176..fe5a871d 100644 --- a/lua/plugins/oil.lua +++ b/lua/plugins/oil.lua @@ -2,7 +2,7 @@ return { 'stevearc/oil.nvim', config = function() - require("oil").setup(); + require('oil').setup() vim.keymap.set('n', '-', 'Oil --float', { desc = 'Open current directory' }) end }; diff --git a/lua/plugins/whichkey.lua b/lua/plugins/whichkey.lua index 509fbd07..f0a90b20 100644 --- a/lua/plugins/whichkey.lua +++ b/lua/plugins/whichkey.lua @@ -7,6 +7,7 @@ return { 'folke/which-key.nvim', opts = {}, ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, ['gh'] = { name = '[G]it [H]unk', _ = 'which_key_ignore' }, + ['h'] = { name = '[H]arpoon'}, ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },