X-Git-Url: https://git.sthu.org/?a=blobdiff_plain;f=dotfiles%2Fshell%2Fzshrc;h=291c4ab2469f39ef41d3cf4f95a159b3cc1418c4;hb=fd527ab23aced571eb846d1250b3fba970e70b0a;hp=92d5b02b9a9aa7ae32135fa9c64eeeaaf460920c;hpb=daf1e83f61fe5641f9eaaa655252ba2584b0b0e6;p=shutils.git diff --git a/dotfiles/shell/zshrc b/dotfiles/shell/zshrc index 92d5b02..291c4ab 100644 --- a/dotfiles/shell/zshrc +++ b/dotfiles/shell/zshrc @@ -7,14 +7,10 @@ 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 +zstyle ':completion::complete:*' use-cache 1 autoload colors zsh/terminfo if [[ "$terminfo[colors]" -ge 8 ]]; then @@ -25,11 +21,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 +78,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,25 +89,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=$(/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}" + PR_EXIT="%{$fg_bold[red]%}%(?..[%?] )%{$reset_color%}" + + # autofs always complains not being able to mount .hg/ and the like + if echo "$autofs_mp" | /bin/grep -qe "^$PWD\s"; then + vcs_info_msg_0_="[autofs]" + else + vcs_info fi - vcs_info + + 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 + }