Skip to content

Commit

Permalink
extensions:fugitive: add repo name
Browse files Browse the repository at this point in the history
Signed-off-by: Timon van der Berg <tmnvanderberg@gmail.com>
  • Loading branch information
tmnvanderberg committed Aug 4, 2024
1 parent 544dd15 commit 04e7826
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lua/lualine/extensions/fugitive.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ 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: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' },
}

Expand Down

0 comments on commit 04e7826

Please sign in to comment.