From b6f5415961ff03a8b4fc680f1faa8fa11ab439fc Mon Sep 17 00:00:00 2001 From: Nikita Avgustanov Date: Thu, 13 Nov 2025 22:53:38 +0400 Subject: [PATCH] Added harpoon and autopairs plugins --- lua/custom/plugins/autopairs.lua | 7 ++++ lua/custom/plugins/harpoon.lua | 64 ++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 lua/custom/plugins/autopairs.lua create mode 100644 lua/custom/plugins/harpoon.lua diff --git a/lua/custom/plugins/autopairs.lua b/lua/custom/plugins/autopairs.lua new file mode 100644 index 00000000..1e80eb48 --- /dev/null +++ b/lua/custom/plugins/autopairs.lua @@ -0,0 +1,7 @@ +return { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + config = true, + -- use opts = {} for passing setup options + -- this is equivalent to setup({}) function +} diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua new file mode 100644 index 00000000..76b99ac0 --- /dev/null +++ b/lua/custom/plugins/harpoon.lua @@ -0,0 +1,64 @@ +return { + 'ThePrimeagen/harpoon', + branch = 'harpoon2', + commit = 'e76cb03', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + local harpoon = require 'harpoon' + harpoon:setup { + settings = { + save_on_toggle = true, + mark_branch = true, + }, + } + + -- basic telescope configuration + local conf = require('telescope.config').values + local function toggle_telescope(harpoon_files) + local file_paths = {} + for _, item in ipairs(harpoon_files.items) do + table.insert(file_paths, item.value) + end + + require('telescope.pickers') + .new({}, { + prompt_title = 'Harpoon', + finder = require('telescope.finders').new_table { + results = file_paths, + }, + previewer = conf.file_previewer {}, + sorter = conf.generic_sorter {}, + }) + :find() + end + + vim.keymap.set('n', '', function() + toggle_telescope(harpoon:list()) + end, { desc = 'Open harpoon window' }) + + vim.keymap.set('n', 'ha', function() + harpoon:list():add() + end, { desc = '[H]arpoon [A]dd mark' }) + + vim.keymap.set('n', '', function() + harpoon:list():select(1) + end) + vim.keymap.set('n', '', function() + harpoon:list():select(2) + end) + vim.keymap.set('n', '', function() + harpoon:list():select(3) + end) + vim.keymap.set('n', '', function() + harpoon:list():select(4) + end) + + -- Toggle previous & next buffers stored within Harpoon list + vim.keymap.set('n', 'hp', function() + harpoon:list():prev() + end, { desc = '[H]arpoon [P]rev item' }) + vim.keymap.set('n', 'hn', function() + harpoon:list():next() + end, { desc = '[H]arpoon [N]ext item' }) + end, +}