From 421382f27c0aa60663e5e02d08a5d04a07c101a0 Mon Sep 17 00:00:00 2001 From: Alexander Navarro Date: Thu, 20 Apr 2023 18:36:14 -0400 Subject: [PATCH] add harpoon.lua --- config/nvim/lua/aleidk/plugins/harpoon.lua | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 config/nvim/lua/aleidk/plugins/harpoon.lua diff --git a/config/nvim/lua/aleidk/plugins/harpoon.lua b/config/nvim/lua/aleidk/plugins/harpoon.lua new file mode 100644 index 0000000..7871e57 --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/harpoon.lua @@ -0,0 +1,55 @@ +return { + "ThePrimeagen/harpoon", + -- lazy = false, + opts = { + global_settings = { + -- sets the marks upon calling `toggle` on the ui, instead of require `:w`. + save_on_toggle = true, + -- saves the harpoon file upon every change. disabling is unrecommended. + save_on_change = true, + -- sets harpoon to run the command immediately as it's passed to the terminal when calling `sendCommand`. + enter_on_sendcmd = true, + -- closes any tmux windows harpoon that harpoon creates when you close Neovim. + tmux_autoclose_windows = false, + -- filetypes that you want to prevent from adding to the harpoon list menu. + excluded_filetypes = { "harpoon" }, + -- set marks specific to each git branch inside git repository + mark_branch = false, + }, + }, + config = function(_, opts) + require("harpoon").setup(opts) + + local mark = require("harpoon.mark") + local ui = require("harpoon.ui") + local telescope = require("telescope") + + telescope.load_extension("harpoon") + + local function map(key, func, desc) + vim.keymap.set("n", "" .. key, func, { desc = desc }) + end + + map("n", mark.add_file, "Add mark") + + map("t", ui.toggle_quick_menu, "Toogle UI") + + map("j", function() + ui.nav_file(1) + end, "Navigate to file 1") + + map("k", function() + ui.nav_file(2) + end, "Navigate to file 2") + + map("l", function() + ui.nav_file(3) + end, "Navigate to file 3") + + map("ñ", function() + ui.nav_file(4) + end, "Navigate to file 4") + + map("T", "Telescope harpoon marks", "Open marks in telescope") + end, +}