Files
.dotfiles/.config/nvim/lua/plugin/bufferline.lua

30 lines
982 B
Lua

---@type LazySpec
return { {
'akinsho/bufferline.nvim', -- shows the opened buffers
event = 'VeryLazy',
dependencies = { 'nvim-tree/nvim-web-devicons', },
---@type bufferline.UserConfig
opts = {
options = {
mode = 'buffers',
separator_style = '',
sort_by = 'directory',
diagnostics = 'nvim_lsp',
diagnostics_indicator = function(c, _, _, _)
return '(' .. c .. ')'
end,
},
},
config = function(_, opts)
require('bufferline').setup(opts)
Map('n', '<tab>', '<cmd>BufferLineCycleNext<cr>', { desc = 'switch to the next tab' })
Map('n', '<s-tab>', '<cmd>BufferLineCyclePrev<cr>', { desc = 'switch to the previous tab' })
Map('n', '<leader>wch', '<cmd>BufferLineCloseLeft<cr>', { desc = 'close the tabs on the left' })
Map('n', '<leader>wcl', '<cmd>BufferLineCloseRight<cr>', { desc = 'close the tabs on the right' })
Map('n', '<leader>wcw', '<cmd>BufferLineCloseOthers<cr>',
{ desc = 'close all tabs except the current one' })
end,
} }