Added harpoon and autopairs plugins

This commit is contained in:
Nikita Avgustanov 2025-11-13 22:53:38 +04:00
parent 4dff548e94
commit b6f5415961
2 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,7 @@
return {
'windwp/nvim-autopairs',
event = 'InsertEnter',
config = true,
-- use opts = {} for passing setup options
-- this is equivalent to setup({}) function
}

View File

@ -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', '<C-h>', function()
toggle_telescope(harpoon:list())
end, { desc = 'Open harpoon window' })
vim.keymap.set('n', '<leader>ha', function()
harpoon:list():add()
end, { desc = '[H]arpoon [A]dd mark' })
vim.keymap.set('n', '<C-1>', function()
harpoon:list():select(1)
end)
vim.keymap.set('n', '<C-2>', function()
harpoon:list():select(2)
end)
vim.keymap.set('n', '<C-3>', function()
harpoon:list():select(3)
end)
vim.keymap.set('n', '<C-4>', function()
harpoon:list():select(4)
end)
-- Toggle previous & next buffers stored within Harpoon list
vim.keymap.set('n', '<leader>hp', function()
harpoon:list():prev()
end, { desc = '[H]arpoon [P]rev item' })
vim.keymap.set('n', '<leader>hn', function()
harpoon:list():next()
end, { desc = '[H]arpoon [N]ext item' })
end,
}