diff --git a/lazy-lock.json b/lazy-lock.json index 9ad7301..5480e2d 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,6 +1,6 @@ { "LuaSnip": { "branch": "master", "commit": "45db5addf8d0a201e1cf247cae4cdce605ad3768" }, - "bufferline.nvim": { "branch": "main", "commit": "0b2fd861eee7595015b6561dade52fb060be10c4" }, + "barbar.nvim": { "branch": "master", "commit": "31b6951c53a59bccfa91bf3984ed1510a940c836" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, diff --git a/lua/plugins/barbar.lua b/lua/plugins/barbar.lua new file mode 100644 index 0000000..098cbe5 --- /dev/null +++ b/lua/plugins/barbar.lua @@ -0,0 +1,54 @@ +vim.g.barbar_auto_setup = false + +return { + { + 'romgrk/barbar.nvim', + dependencies = { + 'lewis6991/gitsigns.nvim', + 'nvim-tree/nvim-web-devicons', + }, + version = '^1.0.0', + config = function() + require('barbar').setup { + icons = { + pinned = { button = '', filename = true }, + }, + } + + local function map(mode, lhs, rhs, desc) + local opts = { silent = true, noremap = true, desc = desc or '' } + vim.keymap.set(mode, lhs, rhs, opts) + end + + map('n', '', 'BufferPrevious', 'Goto Previous Buffer') + map('n', '', 'BufferNext', 'Goto Next Buffer') + map('n', '[b', 'BufferPrevious', 'Goto Previous Buffer') + map('n', ']b', 'BufferNext', 'Goto Next Buffer') + + map('n', '', 'BufferMovePrevious', 'Move Buffer Left') + map('n', '>', 'BufferMoveNext', 'Move Buffer Right') + map('n', '[B', 'BufferMovePrevious', 'Move Buffer Left') + map('n', ']B', 'BufferMoveNext', 'Move Buffer Right') + + map('n', '', 'BufferGoto 1', 'Goto Buffer #1') + map('n', '', 'BufferGoto 2', 'Goto Buffer #2') + map('n', '', 'BufferGoto 3', 'Goto Buffer #3') + map('n', '', 'BufferGoto 4', 'Goto Buffer #4') + map('n', '', 'BufferGoto 5', 'Goto Buffer #5') + map('n', '', 'BufferGoto 6', 'Goto Buffer #6') + map('n', '', 'BufferGoto 7', 'Goto Buffer #7') + map('n', '', 'BufferGoto 8', 'Goto Buffer #8') + map('n', '', 'BufferGoto 9', 'Goto Buffer #9') + map('n', '', 'BufferLast', 'Goto Last Buffer') + + map('n', '', 'BufferPin', 'Pin/Unpin Buffer') + map('n', 'bp', 'BufferPin', 'Toggle [P]in') + + map('n', '', 'BufferClose', 'Close Current Buffer') + map('n', 'bd', 'BufferClose', 'Close Current Buffer') + + map('n', 'bc', 'BufferCloseAllButCurrentOrPined', 'Close Other Buffers') + map('n', 'ba', 'BufferCloseAllBunPinned', 'Close All Buffers') + end, + }, +} diff --git a/lua/plugins/bufferline.lua b/lua/plugins/bufferline.lua deleted file mode 100644 index 22071b0..0000000 --- a/lua/plugins/bufferline.lua +++ /dev/null @@ -1,37 +0,0 @@ --- Required by bufferline -vim.opt.termguicolors = true - -return { - { - 'akinsho/bufferline.nvim', - dependencies = { - 'nvim-tree/nvim-web-devicons', - }, - config = function() - require('bufferline').setup { - options = { - always_show_bufferline = true, - offsets = { - { - filetype = 'neo-tree', - text = 'Neo-tree', - highlight = 'Directory', - text_align = 'left', - }, - }, - }, - } - - vim.keymap.set('n', 'bd', 'bdelete', { desc = '[D]elete Buffer' }) - vim.keymap.set('n', 'bp', 'BufferLineTogglePin', { desc = 'Toggle [P]in' }) - vim.keymap.set('n', 'bP', 'BufferLineGroupClose ungrouped', { desc = 'Delete Un-[P]inned Buffers' }) - vim.keymap.set('n', 'bo', 'BufferLineCloseOthers', { desc = 'Delete All [O]ther Buffers' }) - vim.keymap.set('n', 'br', 'BufferLineCloseRight', { desc = 'Delete Buffers to the [R]ight' }) - vim.keymap.set('n', 'bl', 'BufferLineCloseLeft', { desc = 'Delete Buffers to the [L]eft' }) - vim.keymap.set('n', '[b', 'BufferLineCyclePrev', { desc = 'Prev Buffer' }) - vim.keymap.set('n', ']b', 'BufferLineCycleNext', { desc = 'Next Buffer' }) - vim.keymap.set('n', '[B', 'BufferLineMovePrev', { desc = 'Move buffer prev' }) - vim.keymap.set('n', ']B', 'BufferLineMoveNext', { desc = 'Move buffer next' }) - end, - }, -}