]> git.draconx.ca Git - zshconf.git/commitdiff
zshrc: Cleanup.
authorNick Bowler <nbowler@elliptictech.com>
Thu, 21 Jan 2010 19:02:40 +0000 (14:02 -0500)
committerNick Bowler <nbowler@elliptictech.com>
Thu, 21 Jan 2010 19:02:40 +0000 (14:02 -0500)
Remove unnecessary quoting, use zsh-isms consistently.

zshrc

diff --git a/zshrc b/zshrc
index f1a3191a957b9ca626ca500b8045b2fd663db578..899be85ed31a666b1b7009a56509f4bb36a75680 100644 (file)
--- a/zshrc
+++ b/zshrc
@@ -1,16 +1,16 @@
-if [ -n "$HOME" ]; then
-       HISTFILE="$HOME/.zsh_history"
+if [[ -n $HOME ]]; then
+       HISTFILE=$HOME/.zsh_history
        SAVEHIST=1000
 fi
 HISTSIZE=1000
 
 bindkey -e
 
-case "$TERM" in
+case $TERM in
 rxvt*)
-       if [ "$TERM" = "rxvt-unicode" ]; then
-               [ -z "$COLORTERM" ] && export COLORTERM="rxvt-xpm"
-               [ -z "$COLORFGBG" ] && export COLORFGBG="15;default;0"
+       if [[ $TERM == rxvt-unicode ]]; then
+               [[ -z $COLORTERM ]] && export COLORTERM='rxvt-xpm'
+               [[ -z $COLORFGBG ]] && export COLORFGBG='15;default;0'
        fi
 
        bindkey '\e[3~' delete-char
@@ -24,15 +24,15 @@ screen*|linux)
 ;;
 xterm)
        bindkey '\e[3~' delete-char
-       bindkey '\e[F' end-of-line
-       bindkey '\e[H' beginning-of-line
-       bindkey '\eOH' beginning-of-line
-       bindkey '\eOF' end-of-line
+       bindkey '\e[F'  end-of-line
+       bindkey '\e[H'  beginning-of-line
+       bindkey '\eOH'  beginning-of-line
+       bindkey '\eOF'  end-of-line
 ;;
 esac
 
 # Set the xterm title
-case "$TERM" in
+case $TERM in
         xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
                 settitle() { print -Pn $'\e]0;%n@%m %33<...<%~%<<\a' }
                 ;;
@@ -44,11 +44,12 @@ case "$TERM" in
                ;;
 esac
 
+# Show the return code of failed commands, but don't be noisy about it.
 precmd() {
        settitle
 
-       if [[ -n "$__NEWRUN" ]]; then
-               RPS1=$'%(0?,,%{\e[31;1m%}RC=%?%{\e[0m%})'
+       if [[ -n $__NEWRUN ]]; then
+               RPS1='%(0?,,%B%F{red}RC=%?%f%b)'
                unset __NEWRUN
        else
                unset RPS1
@@ -60,15 +61,15 @@ preexec() {
 }
 
 # A gentoo-like prompt.
-PS1=$'%B%(!,%F{red},%F{green}%n@)%m %F{blue}%33<...<%~%<< %#%f%b '
+PS1='%B%(!,%F{red},%F{green}%n@)%m %F{blue}%33<...<%~%<< %#%f%b '
 
-if [ -n "$COLORTERM" ]; then
-       # Random colour-related options
+if [ -n $COLORTERM ]; then
+       # Assorted colour-related options
        export MINICOM="-c on"
 fi
 
-if [[ -n "$SSH_CONNECTION" ]]; then
-       PS1="${PS1/green/yellow}"
+if [[ -n $SSH_CONNECTION ]]; then
+       PS1=${PS1/green/yellow}
 fi
 
 # Locale