[neovim] Show the base directory of the current project to the left side of the buffer line

This commit is contained in:
Daniel Carrillo 2023-10-07 19:15:40 +02:00
parent 81825f2610
commit 47f493b203
Signed by: dcarrillo
GPG Key ID: E4CD5C09DAED6E16
1 changed files with 26 additions and 1 deletions

View File

@ -1,4 +1,18 @@
require("bufferline").setup({
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({
options = {
close_command = "Bdelete! %d",
right_mouse_command = "Bdelete! %d",
@ -13,5 +27,16 @@ require("bufferline").setup({
enabled = false,
},
separator_style = "slant",
custom_areas = {
left = function()
local text = ""
if not is_buffer_loaded("neo-tree") then
text = "" .. string.gsub(vim.loop.cwd(), "^" .. os.getenv("HOME"), "~") .. ""
end
return { { text = text, fg = "#636E7B" } }
end,
},
},
})