aboutsummaryrefslogtreecommitdiff
path: root/zsh
diff options
context:
space:
mode:
Diffstat (limited to 'zsh')
-rw-r--r--zsh/appearance.zsh38
1 files changed, 6 insertions, 32 deletions
diff --git a/zsh/appearance.zsh b/zsh/appearance.zsh
index 3aca4f0..45ff5bc 100644
--- a/zsh/appearance.zsh
+++ b/zsh/appearance.zsh
@@ -36,13 +36,12 @@ function theme_preexec () {
echo "($fg[magenta]`date +%r`$reset_color) $fg[cyan]$3$reset_color"
}
-# print the exit code of the previous command in red if non-zero
-function return_code {
- echo "%(?..%{$fg[red]%}%?%{$reset_color%} )"
+# print the prompt charin red if last command exited non-zero
+function prompt_char {
+ echo "%(?.$.%{$fg[red]%}$%{$reset_color%})"
}
function repo_prompt_info {
-
# git
ref=$(git symbolic-ref HEAD 2> /dev/null || git rev-parse --short HEAD 2> /dev/null)
if [ $? -eq 0 ]; then
@@ -50,39 +49,14 @@ function repo_prompt_info {
echo "%{$fg[cyan]%}%{\e[1m%}${ref#refs/heads/}%{$reset_color%}"
return
fi
-
- # svn
- info=$(svn info 2>/dev/null)
- if [ $? -eq 0 ]; then
- rev=$(echo "$info" | grep Revision | sed 's/Revision: //')
- echo "%{$fg[cyan]%}%{\e[1m%}r${rev}%{$reset_color%}"
- return
- fi
-}
-
-function env_prompt_info {
- if [ -n "$VIRTUAL_ENV" ]; then
- echo "%{$fg[green]%}$(basename $VIRTUAL_ENV)%{$reset_color%}"
- return
- fi
}
function workspace_prompt_info {
- environment=$(env_prompt_info)
repo=$(repo_prompt_info)
- if [ "$environment" -a "$repo" ]; then
- echo "[$environment|$repo] $"
- return
- fi
- if [ "$environment" ]; then
- echo "[$environment] $"
- return
- fi
if [ "$repo" ]; then
- echo "[$repo] $"
+ echo "[$repo] "
return
fi
- echo "$"
}
# print the hostname in green if local, else red
@@ -90,10 +64,10 @@ function hostname_info {
if [[ $ZSH_LOCAL_ENV == "true" ]]; then
echo "%{$fg[green]%}%{$ZSH_HOST_PREFIX%}%m%{$ZSH_HOST_SUFFIX%}%{$reset_color%}"
else
- echo "%{$fg[green]%}%{$bg[red]%}%{$ZSH_HOST_PREFIX%}%m%{$ZSH_HOST_SUFFIX%}%{$reset_color%}"
+ echo "%{$fg[red]%}%{$ZSH_HOST_PREFIX%}%m%{$ZSH_HOST_SUFFIX%}%{$reset_color%}"
fi
}
# a colorful multiline prompt using the above defined functions
PROMPT=$'%{$fg[yellow]%}%n%{$reset_color%}@$(hostname_info):%{$fg[blue]%}%~%{$reset_color%}
-$(return_code)$(workspace_prompt_info)%{$reset_color%} '
+$(workspace_prompt_info)$(prompt_char)%{$reset_color%} '