From 666a2109d1f202662284f38fe5aeba9e02b2eb4e Mon Sep 17 00:00:00 2001 From: thek4n Date: Wed, 3 Apr 2024 10:59:07 +0300 Subject: [PATCH] vim plugin buffer_manager --- .../nvim/lua/base/plugins/buffer_manager.lua | 15 +++++ .../.config/nvim/lua/base/plugins/harpoon.lua | 64 ------------------- .../nvim/lua/base/plugins/telescope.lua | 2 +- 3 files changed, 16 insertions(+), 65 deletions(-) create mode 100644 home/user/.config/nvim/lua/base/plugins/buffer_manager.lua delete mode 100644 home/user/.config/nvim/lua/base/plugins/harpoon.lua diff --git a/home/user/.config/nvim/lua/base/plugins/buffer_manager.lua b/home/user/.config/nvim/lua/base/plugins/buffer_manager.lua new file mode 100644 index 0000000..be48ee6 --- /dev/null +++ b/home/user/.config/nvim/lua/base/plugins/buffer_manager.lua @@ -0,0 +1,15 @@ +return { + "j-morano/buffer_manager.nvim", + dependencies = { + "nvim-lua/plenary.nvim" + }, + config = function() + local map = vim.keymap.set + map("n", "", require("buffer_manager.ui").toggle_quick_menu) + vim.api.nvim_command([[ + autocmd FileType buffer_manager vnoremap P :m '>+1gv=gv + autocmd FileType buffer_manager vnoremap N :m '<-2gv=gv + ]]) + + end +} \ No newline at end of file diff --git a/home/user/.config/nvim/lua/base/plugins/harpoon.lua b/home/user/.config/nvim/lua/base/plugins/harpoon.lua deleted file mode 100644 index 4bf756a..0000000 --- a/home/user/.config/nvim/lua/base/plugins/harpoon.lua +++ /dev/null @@ -1,64 +0,0 @@ -return { - "ThePrimeagen/harpoon", - branch = "harpoon2", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-telescope/telescope.nvim" - }, - config = function() - local harpoon = require("harpoon") - - harpoon:setup() - - vim.keymap.set("n", "ha", function() harpoon:list():append() end, - {desc = "Append file to session manager"} - ) - - vim.keymap.set("n", "hd", function() harpoon:list():remove() end, - {desc = "Remove file from session manager"} - ) - - vim.keymap.set("n", "fh", ":Telescope harpoon marks", - {desc = "Remove file from session manager"} - ) - - vim.keymap.set("n", "1", function() harpoon:list():select(1) end) - vim.keymap.set("n", "2", function() harpoon:list():select(2) end) - vim.keymap.set("n", "3", function() harpoon:list():select(3) end) - vim.keymap.set("n", "4", function() harpoon:list():select(4) end) - - -- Toggle previous & next buffers stored within Harpoon list - vim.keymap.set("n", "", function() harpoon:list():prev() end) - vim.keymap.set("n", "", function() harpoon:list():next() end) - - vim.keymap.set("n", "", - function() - vim.ui.input({ prompt = "Harpoon mark index: " }, function(input) - local num = tonumber(input) - if num then - require("harpoon"):list():select(num) - end - end) - end - ) - - 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 - - end -} \ No newline at end of file diff --git a/home/user/.config/nvim/lua/base/plugins/telescope.lua b/home/user/.config/nvim/lua/base/plugins/telescope.lua index 700ecaa..64466e4 100644 --- a/home/user/.config/nvim/lua/base/plugins/telescope.lua +++ b/home/user/.config/nvim/lua/base/plugins/telescope.lua @@ -10,7 +10,7 @@ return { } }, keys = { - { '', 'Telescope buffers' }, + { 'fb', 'Telescope buffers' }, { 'ff', 'Telescope find_files' }, { 'fg', 'Telescope live_grep' }, { 'fc', 'Telescope git_commits' },