kickstart.nvim/lua/custom/plugins/init.lua

70 lines
2.4 KiB
Lua

-- 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 = {
{ '<leader>bp', '<Cmd>BufferLineTogglePin<CR>', desc = 'Toggle Pin' },
{ '<leader>bP', '<Cmd>BufferLineGroupClose ungrouped<CR>', desc = 'Delete Non-Pinned Buffers' },
{ '<leader>br', '<Cmd>BufferLineCloseRight<CR>', desc = 'Delete Buffers to the Right' },
{ '<leader>bl', '<Cmd>BufferLineCloseLeft<CR>', desc = 'Delete Buffers to the Left' },
{ '<S-h>', '<cmd>BufferLineCyclePrev<cr>', desc = 'Prev Buffer' },
{ '<S-l>', '<cmd>BufferLineCycleNext<cr>', desc = 'Next Buffer' },
{ '[b', '<cmd>BufferLineCyclePrev<cr>', desc = 'Prev Buffer' },
{ ']b', '<cmd>BufferLineCycleNext<cr>', desc = 'Next Buffer' },
{ '[B', '<cmd>BufferLineMovePrev<cr>', desc = 'Move buffer prev' },
{ ']B', '<cmd>BufferLineMoveNext<cr>', 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
},
},
}