feat(nvim-tree): show git branch

This commit is contained in:
2025-04-29 10:20:23 +02:00
parent 9883fcc3ea
commit 6d7b4927de
+12 -2
View File
@@ -75,7 +75,10 @@ end
---@type LazyPluginSpec ---@type LazyPluginSpec
return { return {
"nvim-tree/nvim-tree.lua", "nvim-tree/nvim-tree.lua",
dependencies = { "nvim-tree/nvim-web-devicons" }, dependencies = {
"tpope/vim-fugitive",
"nvim-tree/nvim-web-devicons",
},
event = "VimEnter", event = "VimEnter",
keys = { keys = {
{ {
@@ -168,7 +171,14 @@ return {
}, },
renderer = { renderer = {
full_name = true, full_name = true,
root_folder_label = ":~", root_folder_label = function(path)
local label = vim.fn.fnamemodify(path, ":~")
local git_head = vim.fn.FugitiveHead()
if git_head ~= "" then
label = label .. (" (%s)"):format(git_head)
end
return label
end,
special_files = {}, special_files = {},
decorators = { decorators = {
"Git", "Git",