From 4a9708600a674b97a8bc29f592c6fa9e229387eb Mon Sep 17 00:00:00 2001 From: Timon van der Berg Date: Sun, 4 Aug 2024 12:33:31 +0200 Subject: [PATCH] extensions:fugitive: add repo name Signed-off-by: Timon van der Berg --- lua/lualine/extensions/fugitive.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lua/lualine/extensions/fugitive.lua b/lua/lualine/extensions/fugitive.lua index 6e75e401f..dc175b70c 100644 --- a/lua/lualine/extensions/fugitive.lua +++ b/lua/lualine/extensions/fugitive.lua @@ -7,8 +7,17 @@ local function fugitive_branch() return icon .. ' ' .. vim.fn.FugitiveHead() end +local function get_git_toplevel_basename() + local handle = io.popen("basename `git rev-parse --show-toplevel`") + local result = handle:read("*a") + handle:close() + -- return result + return result:match("^%s*(.-)%s*$") -- trim any whitespace +end + M.sections = { - lualine_a = { fugitive_branch }, + lualine_a = { get_git_toplevel_basename }, + lualine_b = { fugitive_branch }, lualine_z = { 'location' }, }