Reputation: 9718
I'm having a blast with oh-my-zsh and enjoying the spaceship prompt.
Just like it is showing my git branch and status - how can I make it show my current git user right next to that?
(The reason for asking is because I'm doing pair coding and it would therefore be useful info)
Upvotes: 3
Views: 3864
Reputation: 27768
You can achieve this by writing a custom section for spaceship-prompt.
spaceship_git_user() {
spaceship::is_git || return
local username
username="$(git config user.name)"
if [[ -n $username ]]; then
spaceship::section \
"magenta" \
"$username"
fi
}
Then, add the custom section into spaceship prompt.
SPACESHIP_PROMPT_ORDER=(
# content omitted ...
git_user
# content omitted ...
)
Put these two parts into your .zshrc
before your prompt (spaceship) is initialized.
References
Upvotes: 2