diff --git a/home/programs/nvim/.default.nix.swp b/home/programs/nvim/.default.nix.swp deleted file mode 100644 index a901979..0000000 Binary files a/home/programs/nvim/.default.nix.swp and /dev/null differ diff --git a/home/programs/nvim/default.nix b/home/programs/nvim/default.nix index cca46ef..a80e6c3 100644 --- a/home/programs/nvim/default.nix +++ b/home/programs/nvim/default.nix @@ -52,10 +52,10 @@ # plugin = vim-airline; # config = toLuaFile ./plugins/airline.lua; # } - # { - # plugin = barbar-nvim; - # config = toLuaFile ./plugins/bufferline.lua; - # } + { + plugin = barbar-nvim; + config = toLuaFile ./plugins/barbar.lua; + } ]; # extraConfig = lib.fileContents ./init.vim; diff --git a/home/programs/nvim/plugins/barbar.lua b/home/programs/nvim/plugins/barbar.lua new file mode 100644 index 0000000..4df419f --- /dev/null +++ b/home/programs/nvim/plugins/barbar.lua @@ -0,0 +1,76 @@ +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 + +vim.g.barbar_auto_setup = false -- disable auto-setup + +require'barbar'.setup { + -- Enable/disable animations + animation = true, + + -- Automatically hide the tabline when there are this many buffers left. + -- Set to any value >=0 to enable. + auto_hide = false, + + -- Enable/disable current/total tabpages indicator (top right corner) + tabpages = true, + + -- Enables/disable clickable tabs + -- - left-click: go to buffer + -- - middle-click: delete buffer + clickable = true, +} diff --git a/home/programs/nvim/plugins/bufferline.lua b/home/programs/nvim/plugins/bufferline.lua deleted file mode 100644 index 7a47566..0000000 --- a/home/programs/nvim/plugins/bufferline.lua +++ /dev/null @@ -1,80 +0,0 @@ --- Ensure bufferline configuration exists -local bufferline = vim.g.bufferline or {} - --- Enable/disable animations -bufferline.animation = true - --- Enable/disable auto-hiding the tab bar when there is a single buffer --- bufferline.auto_hide = false - --- Enable/disable current/total tabpages indicator (top right corner) -bufferline.tabpages = true - --- Enable/disable close button -bufferline.closable = true - --- Enable/disable clickable tabs --- - left-click: go to buffer --- - middle-click: delete buffer -bufferline.clickable = true - --- Exclude buffers from the tabline --- bufferline.exclude_ft = { 'javascript' } --- bufferline.exclude_name = { 'package.json' } - --- Enable/disable icons --- Options: 'buffer_number', 'numbers', 'both', 'buffer_number_with_icon' -bufferline.icons = true - --- Use nvim-web-devicons colors if false -bufferline.icon_custom_colors = false - --- Configure icons on the bufferline -bufferline.icon_separator_active = '▎' -bufferline.icon_separator_inactive = '▎' -bufferline.icon_close_tab = '' -bufferline.icon_close_tab_modified = '●' -bufferline.icon_pinned = '車' - --- Configure buffer insertion position -bufferline.insert_at_start = false -bufferline.insert_at_end = false - --- Set maximum padding width -bufferline.maximum_padding = 4 - --- Set maximum buffer name length -bufferline.maximum_length = 30 - --- Enable semantic letters for buffer-pick mode -bufferline.semantic_letters = true - --- Define buffer letters order for buffer-pick mode -bufferline.letters = 'asdfjkl;ghnmxcvbziowerutyqpASDFJKLGHNMXCVBZIOWERUTYQP' - --- Set name for unnamed buffers -bufferline.no_name_title = nil - --- Mappings -vim.keymap.set('n', '', 'BufferPrevious', { silent = true }) -vim.keymap.set('n', '', 'BufferNext', { silent = true }) -vim.keymap.set('n', '', 'BufferMovePrevious', { silent = true }) -vim.keymap.set('n', '>', 'BufferMoveNext', { silent = true }) -vim.keymap.set('n', '', 'BufferGoto 1', { silent = true }) -vim.keymap.set('n', '', 'BufferGoto 2', { silent = true }) -vim.keymap.set('n', '', 'BufferGoto 3', { silent = true }) -vim.keymap.set('n', '', 'BufferGoto 4', { silent = true }) -vim.keymap.set('n', '', 'BufferGoto 5', { silent = true }) -vim.keymap.set('n', '', 'BufferGoto 6', { silent = true }) -vim.keymap.set('n', '', 'BufferGoto 7', { silent = true }) -vim.keymap.set('n', '', 'BufferGoto 8', { silent = true }) -vim.keymap.set('n', '', 'BufferGoto 9', { silent = true }) -vim.keymap.set('n', '', 'BufferLast', { silent = true }) -vim.keymap.set('n', '', 'BufferPin', { silent = true }) -vim.keymap.set('n', '', 'BufferClose', { silent = true }) -vim.keymap.set('n', '', 'BufferPick', { silent = true }) -vim.keymap.set('n', 'bb', 'BufferOrderByBufferNumber', { silent = true }) -vim.keymap.set('n', 'bd', 'BufferOrderByDirectory', { silent = true }) -vim.keymap.set('n', 'bl', 'BufferOrderByLanguage', { silent = true }) -vim.keymap.set('n', 'bw', 'BufferOrderByWindowNumber', { silent = true }) -