Skip to content

Commit 4a97086

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

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lua/lualine/extensions/fugitive.lua

+10-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,17 @@ 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
15+
return result:match("^%s*(.-)%s*$") -- trim any whitespace
16+
end
17+
1018
M.sections = {
11-
lualine_a = { fugitive_branch },
19+
lualine_a = { get_git_toplevel_basename },
20+
lualine_b = { fugitive_branch },
1221
lualine_z = { 'location' },
1322
}
1423

0 commit comments

Comments
 (0)