mirror of
https://github.com/dcarrillo/dotfiles.git
synced 2024-12-22 11:38:00 +00:00
[neovim] Show the base directory of the current project to the left side of the buffer line
This commit is contained in:
parent
81825f2610
commit
47f493b203
@ -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 = {
|
options = {
|
||||||
close_command = "Bdelete! %d",
|
close_command = "Bdelete! %d",
|
||||||
right_mouse_command = "Bdelete! %d",
|
right_mouse_command = "Bdelete! %d",
|
||||||
@ -13,5 +27,16 @@ require("bufferline").setup({
|
|||||||
enabled = false,
|
enabled = false,
|
||||||
},
|
},
|
||||||
separator_style = "slant",
|
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,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user