dotfiles/.config/nvim/lua/plugins/bufferline.lua
afonsofrancof ad9912c773
[MINOR] A bunch of things.
Themery for nvim, tmux theme, zsh stuff
2024-01-03 15:12:33 +00:00

76 lines
2.7 KiB
Lua

--KEYBINDINGS
local map = vim.api.nvim_set_keymap
local opts = { noremap = true, silent = true }
-- Move to previous/next
map('n', '<A-h>', '<Cmd>BufferLineCyclePrev<CR>', opts)
map('n', '<A-l>', '<Cmd>BufferLineCycleNext<CR>', opts)
-- Re-order to previous/next
map('n', '<A-H>', '<Cmd>BufferLineMovePrev<CR>', opts)
map('n', '<A-L>', '<Cmd>BufferLineMoveNext<CR>', opts)
-- Goto buffer in position...
map('n', '<A-1>', '<Cmd>BufferLineGoToBuffer 1<CR>', opts)
map('n', '<A-2>', '<Cmd>BufferLineGoToBuffer 2<CR>', opts)
map('n', '<A-3>', '<Cmd>BufferLineGoToBuffer 3<CR>', opts)
map('n', '<A-4>', '<Cmd>BufferLineGoToBuffer 4<CR>', opts)
map('n', '<A-5>', '<Cmd>BufferLineGoToBuffer 5<CR>', opts)
map('n', '<A-6>', '<Cmd>BufferLineGoToBuffer 6<CR>', opts)
map('n', '<A-7>', '<Cmd>BufferLineGoToBuffer 7<CR>', opts)
map('n', '<A-8>', '<Cmd>BufferLineGoToBuffer 8<CR>', opts)
map('n', '<A-9>', '<Cmd>BufferLineGoToBuffer 9<CR>', opts)
-- Close buffer
map('n', '<A-c>', '<Cmd>BufferLinePickClose<CR>', opts)
-- Set bufferline's options
require("bufferline").setup({
options = {
mode = "buffers",
numbers = "none",
close_command = "bdelete! %d",
right_mouse_command = "bdelete! %d",
left_mouse_command = "buffer %d",
middle_mouse_command = "bdelete! %d",
indicator = {
icon = "",
style = "icon",
},
buffer_close_icon = '',
modified_icon = '',
close_icon = '',
left_trunc_marker = '',
right_trunc_marker = '',
max_name_length = 18,
max_prefix_length = 15,
truncate_names = true,
tab_size = 18,
diagnostics = "nvim_lsp",
diagnostics_update_in_insert = true,
diagnostics_indicator = function(count, level, diagnostics_dict, context)
return "(" .. count .. ")"
end,
color_icons = true,
show_buffer_icons = true,
show_buffer_close_icons = true,
show_buffer_default_icon = true,
show_close_icon = true,
show_tab_indicators = true,
show_duplicate_prefix = true,
persist_buffer_sort = true,
separator_style = "slant",
enforce_regular_tabs = true,
always_show_bufferline = true,
hover = {
enabled = true,
delay = 200,
reveal = { 'close' }
},
sort_by = 'insert_after_current',
custom_filter = function(buf_number, buf_numbers)
-- filter out filetypes you don't want to see
if vim.bo[buf_number].filetype ~= "" then
return true
end
end,
},
highlights = require("catppuccin.groups.integrations.bufferline").get()
})