update zshrc
authorStefan Huber <shuber@sthu.org>
Fri, 15 Mar 2013 09:35:38 +0000 (10:35 +0100)
committerStefan Huber <shuber@sthu.org>
Fri, 15 Mar 2013 09:35:38 +0000 (10:35 +0100)
dotfiles/shell/zshrc

index cc00a537b9f712aa9dc7bfd17041c81b7ab39ea9..f339849dce248ca2155b337645f03bf1a847f6c6 100644 (file)
@@ -7,14 +7,11 @@
 bindkey -e
 zstyle :compinstall filename "$HOME/.zshrc"
 
-autoload -Uz compinit
-compinit
 
-if [ -e $HOME/.bash_completion ]; then
-       autoload bashcompinit
-       bashcompinit
-       source $HOME/.bash_completion
-fi
+autoload -U compinit promptinit
+compinit
+promptinit; prompt gentoo
+zstyle ':completion::complete:*' use-cache 1
 
 autoload colors zsh/terminfo
 if [[ "$terminfo[colors]" -ge 8 ]]; then
@@ -25,11 +22,10 @@ eval `dircolors`
 LS_COLORS="${LS_COLORS}*.divx=01;35:"
 zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
 
-TERM=xterm-256color
-
 zstyle ':completion:*' menu select
 zmodload -i zsh/complist
 
+#TERM=xterm-256color
 
 
 # bind special keys according to readline configuration
@@ -83,7 +79,7 @@ HISTFILE=~/.zsh_history
 HISTSIZE=50000
 SAVEHIST=50000
 REPORTTIME=5
-TIMEFMT="$terminfo[bold]$fg[yellow]%J  %U user  %S sys  %P cpu  %*E total  %M kB max$terminfo[sgr0]"
+TIMEFMT="$fg[magenta]%J  %U user  %S sys  %P cpu  %*E total  %M kB max$terminfo[sgr0]"
 
 autoload -Uz vcs_info && vcs_info
 zstyle ':vcs_info:*' enable git cvs svn hg
@@ -94,34 +90,42 @@ zstyle ':vcs_info:*' max-exports 1
 function setprompt()
 {
        # default: " (%s)-[%b|%a]%u%c-"
-       zstyle ':vcs_info:*' actionformats "${PR_YELLOW}%s:%b|%a${PR_NO_COLOUR}"
+       zstyle ':vcs_info:*' actionformats "  %s: %b|%a"
        # default: " (%s)-[%b]%u%c-"
-       zstyle ':vcs_info:*' formats       "${PR_YELLOW}%s:%b${PR_NO_COLOUR}"
+       zstyle ':vcs_info:*' formats       "  %s: %b"
 
        setopt PROMPT_SUBST
-       PROMPT='%(!.$PR_RED.$PR_GREEN)%n@%m $PR_BLUE%1~ %# $PR_NO_COLOUR'
-       RPROMPT='${vcs_info_msg_0_}${PR_STUFF}'
+       PROMPT='
+%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%})%n@%m%{$reset_color%}$PR_SCREEN$PR_JOBS%{$fg_bold[yellow]%}${vcs_info_msg_0_}%{$reset_color%}  %{$fg_bold[blue]%}%~%{$reset_color%}
+$PR_EXIT%# '
 }
 setprompt
 
 # Obtain the autofs mountpoints
 autofs_mp=""
-[ -r /etc/auto.master ] && autofs_mp=$(grep -e "^/" /etc/auto.master)
+[ -r /etc/auto.master ] && autofs_mp=$(/bin/grep -e "^/" /etc/auto.master)
 
 function precmd ()
 {
-       local exitstatus="${?}"
-       PR_STUFF=""
-       if [[ 0 -ne "${exitstatus}" ]] ; then
-               PR_STUFF=" ${PR_RED}RET ${exitstatus}${PR_NO_COLOUR}"
-       fi
+       PR_EXIT="%{$fg_bold[red]%}%(?..[%?] )%{$reset_color%}"
 
        # autofs always complains not being able to mount .hg/ and the like
-       if echo "$autofs_mp" | grep -qe "^$PWD\s"; then
-               vcs_info_msg_0_="${PR_YELLOW}[autofs]${PR_NO_COLOUR}"
+       if echo "$autofs_mp" | /bin/grep -qe "^$PWD\s"; then
+               vcs_info_msg_0_="[autofs]"
        else
                vcs_info
        fi
+
+       PR_SCREEN=""
+       if [[ -n "${WINDOW}" ]]; then
+               PR_SCREEN=" S:${WINDOW}"
+       fi
+
+       PR_JOBS=""
+       if [[ $(jobs | wc -l) -gt 0 ]]; then
+               PR_JOBS=" J:%j"
+       fi
+
 }