From 744ab57569513034af0838be9dfd76b9b7e2ef66 Mon Sep 17 00:00:00 2001 From: Max Luebke Date: Wed, 29 Jan 2025 21:24:44 +0100 Subject: [PATCH] Add barbar plugin and key bindings --- init.lua | 58 +++++++++++++++++++++++++++++++++++++ lua/custom/plugins/init.lua | 17 +++++++++++ 2 files changed, 75 insertions(+) diff --git a/init.lua b/init.lua index ae841e3..af10f98 100644 --- a/init.lua +++ b/init.lua @@ -198,6 +198,64 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the upper win vim.keymap.set('n', 'tt', 'Neotree', { desc = 'Toggle Neo[T]ree' }) +local map = vim.api.nvim_set_keymap +local opts = { noremap = true, silent = true } + +-- Move to previous/next +map('n', '', 'BufferPrevious', opts) +map('n', '', 'BufferNext', opts) + +-- Re-order to previous/next +map('n', '', 'BufferMovePrevious', opts) +map('n', '>', 'BufferMoveNext', opts) + +-- Goto buffer in position... +map('n', '', 'BufferGoto 1', opts) +map('n', '', 'BufferGoto 2', opts) +map('n', '', 'BufferGoto 3', opts) +map('n', '', 'BufferGoto 4', opts) +map('n', '', 'BufferGoto 5', opts) +map('n', '', 'BufferGoto 6', opts) +map('n', '', 'BufferGoto 7', opts) +map('n', '', 'BufferGoto 8', opts) +map('n', '', 'BufferGoto 9', opts) +map('n', '', 'BufferLast', opts) + +-- Pin/unpin buffer +map('n', '', 'BufferPin', opts) + +-- Goto pinned/unpinned buffer +-- :BufferGotoPinned +-- :BufferGotoUnpinned + +-- Close buffer +map('n', '', 'BufferClose', opts) + +-- Wipeout buffer +-- :BufferWipeout + +-- Close commands +-- :BufferCloseAllButCurrent +-- :BufferCloseAllButPinned +-- :BufferCloseAllButCurrentOrPinned +-- :BufferCloseBuffersLeft +-- :BufferCloseBuffersRight + +-- Magic buffer-picking mode +map('n', '', 'BufferPick', opts) +map('n', '', 'BufferPickDelete', opts) + +-- Sort automatically by... +map('n', 'bb', 'BufferOrderByBufferNumber', opts) +map('n', 'bn', 'BufferOrderByName', opts) +map('n', 'bd', 'BufferOrderByDirectory', opts) +map('n', 'bl', 'BufferOrderByLanguage', opts) +map('n', 'bw', 'BufferOrderByWindowNumber', opts) + +-- Other: +-- :BarbarEnable - enables barbar (enabled by default) +-- :BarbarDisable - very bad command, should never be used + -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 50c9cd9..47f0b3c 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -39,4 +39,21 @@ return { }, config = true, }, + { + 'romgrk/barbar.nvim', + dependencies = { + 'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status + 'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons + }, + init = function() + vim.g.barbar_auto_setup = false + end, + opts = { + -- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default: + -- animation = true, + -- insert_at_start = true, + -- …etc. + }, + version = '^1.0.0', -- optional: only update when a new 1.x version is released + }, }