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' }, }