-- You can add your own plugins here or in other files in this directory! -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information return { { 'akinsho/bufferline.nvim', dependencies = 'nvim-tree/nvim-web-devicons', event = 'VeryLazy', keys = { { 'bp', 'BufferLineTogglePin', desc = 'Toggle Pin' }, { 'bP', 'BufferLineGroupClose ungrouped', desc = 'Delete Non-Pinned Buffers' }, { 'br', 'BufferLineCloseRight', desc = 'Delete Buffers to the Right' }, { 'bl', 'BufferLineCloseLeft', desc = 'Delete Buffers to the Left' }, { '', 'BufferLineCyclePrev', desc = 'Prev Buffer' }, { '', 'BufferLineCycleNext', desc = 'Next Buffer' }, { '[b', 'BufferLineCyclePrev', desc = 'Prev Buffer' }, { ']b', 'BufferLineCycleNext', desc = 'Next Buffer' }, { '[B', 'BufferLineMovePrev', desc = 'Move buffer prev' }, { ']B', 'BufferLineMoveNext', desc = 'Move buffer next' }, }, opts = { options = { -- stylua: ignore close_command = function(n) Snacks.bufdelete(n) end, -- stylua: ignore right_mouse_command = function(n) Snacks.bufdelete(n) end, diagnostics = 'nvim_lsp', always_show_bufferline = false, diagnostics_indicator = function(_, _, diag) local icons = LazyVim.config.icons.diagnostics local ret = (diag.error and icons.Error .. diag.error .. ' ' or '') .. (diag.warning and icons.Warn .. diag.warning or '') return vim.trim(ret) end, offsets = { { filetype = 'neo-tree', text = 'Neo-tree', highlight = 'Directory', text_align = 'left', }, { filetype = 'snacks_layout_box', }, }, show_buffer_icons = true, color_icons = true, }, }, config = function(_, opts) require('bufferline').setup(opts) -- Fix bufferline when restoring a session vim.api.nvim_create_autocmd({ 'BufAdd', 'BufDelete' }, { callback = function() vim.schedule(function() pcall(nvim_bufferline) end) end, }) end, }, { 'numToStr/Comment.nvim', opts = { -- add any options here }, }, }