Skip to content

Commit 04e7826

Browse files
committed
extensions:fugitive: add repo name
Signed-off-by: Timon van der Berg <[email protected]>
1 parent 544dd15 commit 04e7826

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lua/lualine/extensions/fugitive.lua

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,16 @@ local function fugitive_branch()
77
return icon .. ' ' .. vim.fn.FugitiveHead()
88
end
99

10+
local function get_git_toplevel_basename()
11+
local handle = io.popen("basename `git rev-parse --show-toplevel`")
12+
local result = handle:read("*a")
13+
handle:close()
14+
return result:match("^%s*(.-)%s*$") -- trim any whitespace
15+
end
16+
1017
M.sections = {
11-
lualine_a = { fugitive_branch },
18+
lualine_a = { get_git_toplevel_basename },
19+
lualine_b = { fugitive_branch },
1220
lualine_z = { 'location' },
1321
}
1422

0 commit comments

Comments
 (0)