1
0
Fork 0

Make prompt work even without git installed

pull/340/head
huyz 12 years ago
parent 6de94b87fe
commit 0fdd2519e6

@ -32,7 +32,7 @@ function prompt_progressive_precmd {
#git_info[remote]="$(git remote -v | fgrep fetch | sed 's/.*[\/:]\([^:\/][^:\/]*\)\.git.*/\1/')" #git_info[remote]="$(git remote -v | fgrep fetch | sed 's/.*[\/:]\([^:\/][^:\/]*\)\.git.*/\1/')"
git_info[repo]=$(basename $(git rev-parse --show-toplevel)) git_info[repo]=$(basename $(git rev-parse --show-toplevel))
fi fi
else elif (( $+functions[vcs_info] )); then
vcs_info vcs_info
fi fi
} }
@ -173,7 +173,7 @@ function prompt_progressive_setup {
# Print up to 5 elements of the current directory # Print up to 5 elements of the current directory
#P+="%5~%f" #P+="%5~%f"
if (( $+functions[git-info] )); then if (( $+functions[git-info] || $+functions[vcs_info] )); then
P+='%~' P+='%~'
else else
# Print current directory or, if inside repo, path relative to that # Print current directory or, if inside repo, path relative to that
@ -210,7 +210,7 @@ function prompt_progressive_setup {
local R local R
if (( $+functions[git-info] )); then if (( $+functions[git-info] )); then
R+='${git_info:+[${(e)git_info[prompt]}${git_info[rprompt]}]}' R+='${git_info:+[${(e)git_info[prompt]}${git_info[rprompt]}]}'
else elif (( $+functions[vcs_info] )); then
R+="${vcs_info_color}"'${vcs_info_msg_1_}'"%f" R+="${vcs_info_color}"'${vcs_info_msg_1_}'"%f"
fi fi
if [[ $style == 'verbose' ]]; then if [[ $style == 'verbose' ]]; then

Loading…
Cancel
Save