prompt: Remove absolute path when in git repo
This commit is contained in:
@@ -91,16 +91,17 @@ set_prompt()
|
||||
fi
|
||||
# user@host
|
||||
PS1="\u\[$txtwht\]@\h"
|
||||
# Current path
|
||||
PS1+="\[$txtgrn\]\w "
|
||||
# Git repo + path in repo
|
||||
if [ "$is_git" ]; then
|
||||
local git_repo=$(basename `git rev-parse --show-toplevel` 2>/dev/null)
|
||||
local git_rel_path=$(git rev-parse --show-prefix 2>/dev/null)
|
||||
PS1+="\[$txtcyn\]$git_repo \[$txtpur\]$git_rel_path\[$txtrst\]"
|
||||
PS1+="\[$txtcyn\][$git_repo] \[$txtpur\]$git_rel_path\[$txtrst\]"
|
||||
# Green git branch
|
||||
PS1+="\[$txtgrn\]$(__git_ps1 '(%s')\[$txtwht\]"
|
||||
PS1+="$(format_modified)\[$txtgrn\])\[$txtrst\] "
|
||||
else
|
||||
# Current path
|
||||
PS1+="\[$txtgrn\]\w "
|
||||
fi
|
||||
# Good old prompt, $ for user, # for root
|
||||
PS1+="\[$txtrst\]\\$ "
|
||||
|
||||
Reference in New Issue
Block a user