37 lines
1.2 KiB
Lua
37 lines
1.2 KiB
Lua
local close_func = function(bufnum)
|
|
local bufdelete_avail, bufdelete = pcall(require, "bufdelete")
|
|
if bufdelete_avail then
|
|
bufdelete.bufdelete(bufnum, true)
|
|
else
|
|
vim.cmd.bdelete { args = { bufnum }, bang = true }
|
|
end
|
|
end
|
|
require("bufferline").setup(astronvim.user_plugin_opts("plugins.bufferline", {
|
|
options = {
|
|
offsets = {
|
|
{ filetype = "NvimTree", text = "", padding = 1 },
|
|
{ filetype = "neo-tree", text = "", padding = 1 },
|
|
{ filetype = "Outline", text = "", padding = 1 },
|
|
},
|
|
buffer_close_icon = astronvim.get_icon "BufferClose",
|
|
modified_icon = astronvim.get_icon "FileModified",
|
|
close_icon = astronvim.get_icon "NeovimClose",
|
|
close_command = close_func,
|
|
right_mouse_command = close_func,
|
|
max_name_length = 14,
|
|
max_prefix_length = 13,
|
|
tab_size = 20,
|
|
separator_style = "thin",
|
|
},
|
|
}))
|
|
local highlights = require "bufferline.highlights"
|
|
vim.api.nvim_create_autocmd("User", {
|
|
pattern = "AstroColorScheme",
|
|
group = "BufferlineCmds",
|
|
desc = "Bufferline apply colors after astronvim colorscheme change",
|
|
callback = function()
|
|
highlights.reset_icon_hl_cache()
|
|
highlights.set_all(require("bufferline.config").update_highlights())
|
|
end,
|
|
})
|