1
0
Fork 0
dotfiles/.config/nvim/lua/plugins/misc/bufferline.lua

59 lines
1.3 KiB
Lua

local M = { "akinsho/bufferline.nvim" }
M.event = { "BufReadPost", "BufNewFile" }
M.opts = function()
local icons = require("config.icons")
local function diagnostics_indicator(_, _, diagnostics, _)
local result = {}
local symbols = {
error = icons.Error,
warning = icons.Warn,
info = icons.Info,
}
for name, count in pairs(diagnostics) do
if symbols[name] and count > 0 then
table.insert(result, symbols[name] .. " " .. count)
end
end
local result_str = table.concat(result, " ")
return #result_str > 0 and result_str or ""
end
local config = {
highlights = {
background = {
italic = true,
bold = false,
},
buffer_selected = {
italic = false,
bold = true,
},
},
options = {
indicator = {
style = "none",
},
buffer_close_icon = icons.Close,
modified_icon = icons.Modified,
close_icon = icons.Close,
left_trunc_marker = icons.Truncate,
right_trunc_marker = icons.Truncate,
diagnostics = "nvim_lsp",
diagnostics_indicator = diagnostics_indicator,
offsets = {},
show_buffer_close_icons = false,
show_close_icon = false,
separator_style = { "", "" },
move_wraps_at_ends = true,
always_show_bufferline = false,
sort_by = "id",
},
}
return config
end
return M