Use shorteded form of branch names to minify prompt
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
60d08b8998
commit
bc1a7c9c65
@ -35,6 +35,12 @@ function config-git_prompt() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function shortened_branch() {
|
||||||
|
local branch=$(git_current_branch)
|
||||||
|
[ $(echo -n "${branch}" | wc -c) -gt 15 ] && branch="${branch:0:15}%{$fg[red]%}$(printf '\uf141')%{$reset_color%}"
|
||||||
|
echo "${branch}"
|
||||||
|
}
|
||||||
|
|
||||||
function build_git_prompt() {
|
function build_git_prompt() {
|
||||||
# Allow hiding the right side of the prompt
|
# Allow hiding the right side of the prompt
|
||||||
(test "${NO_RIGHT}" = "true") && return
|
(test "${NO_RIGHT}" = "true") && return
|
||||||
@ -66,7 +72,7 @@ function build_git_prompt() {
|
|||||||
|
|
||||||
# Show current branch and commit / tag
|
# Show current branch and commit / tag
|
||||||
echo -n "%{$reset_color%}"
|
echo -n "%{$reset_color%}"
|
||||||
echo -n "$(git_current_branch) "
|
echo -n "$(shortened_branch) "
|
||||||
echo -n "($(git_describe)) "
|
echo -n "($(git_describe)) "
|
||||||
|
|
||||||
# Print repository status information
|
# Print repository status information
|
||||||
|
Loading…
Reference in New Issue
Block a user