2023-10-07 17:15:40 +00:00
|
|
|
local bufferline = require("bufferline")
|
|
|
|
|
|
|
|
local function is_buffer_loaded(name)
|
|
|
|
local bufs = vim.api.nvim_list_bufs()
|
|
|
|
|
|
|
|
for _, buffer in pairs(bufs) do
|
|
|
|
if vim.fn.getbufvar(buffer, "&filetype") == name then
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
bufferline.setup({
|
2022-10-01 11:46:18 +00:00
|
|
|
options = {
|
2023-09-16 18:05:38 +00:00
|
|
|
close_command = "Bdelete! %d",
|
|
|
|
right_mouse_command = "Bdelete! %d",
|
2022-11-05 12:30:40 +00:00
|
|
|
offsets = {
|
|
|
|
{ filetype = "neo-tree", text = "", padding = 1 },
|
|
|
|
{ filetype = "dapui_scopes", text = "", padding = 1 },
|
|
|
|
},
|
2022-12-07 12:53:59 +00:00
|
|
|
indicator = {
|
2023-09-16 18:05:38 +00:00
|
|
|
style = "underline",
|
2022-12-07 12:53:59 +00:00
|
|
|
},
|
2023-09-16 18:05:38 +00:00
|
|
|
hover = {
|
2023-10-04 17:49:06 +00:00
|
|
|
enabled = false,
|
2022-10-01 11:46:18 +00:00
|
|
|
},
|
2023-09-16 18:05:38 +00:00
|
|
|
separator_style = "slant",
|
2023-10-07 17:15:40 +00:00
|
|
|
|
|
|
|
custom_areas = {
|
|
|
|
left = function()
|
|
|
|
local text = ""
|
|
|
|
if not is_buffer_loaded("neo-tree") then
|
|
|
|
text = " " .. string.gsub(vim.loop.cwd(), "^" .. os.getenv("HOME"), "~") .. " "
|
|
|
|
end
|
|
|
|
|
2024-02-12 19:46:40 +00:00
|
|
|
return { { text = text, fg = "#adbac7" } }
|
2023-10-07 17:15:40 +00:00
|
|
|
end,
|
|
|
|
},
|
2022-10-01 11:46:18 +00:00
|
|
|
},
|
|
|
|
})
|