X-Git-Url: https://git.siccegge.de//index.cgi?p=dotfiles%2Fzsh.git;a=blobdiff_plain;f=zshrc;h=64ad4eaceb21954fb67ff78829269572a6b7812f;hp=a6df1013f42361caa972ccd9a6f449a9d81168aa;hb=7ae684b2c49b2696455aaf09cde67896c95f9642;hpb=5e67ee3a053f11c2a4d8461b720d1d6da9f9b269 diff --git a/zshrc b/zshrc index a6df101..64ad4ea 100644 --- a/zshrc +++ b/zshrc @@ -34,10 +34,19 @@ colors zmodload -i zsh/complist +_force_rehash() { + if (( CURRENT == 1 )); then + rehash + fi + # We didn't really complete anything. + return 1 +} + zstyle :compinstall filename '/home/christoph/.zshrc' zstyle ':completion:*' menu select=3 zstyle -e ':completion::*:*:*:hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2|_uni|_debian)(N) /dev/null)"}%%[# ]*}//,/ })' zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} +zstyle ':completion:::::' completer _force_rehash _complete _approximate _expand _ignored bindkey -e bindkey 'e' backward-word @@ -55,6 +64,12 @@ setWindowTitle(){ precmd () { vcs_info setWindowTitle ${USER}@${HOST} + + if [[ $UID == 0 && -f `which systemctl` ]] + then + use_systemd=true + systemd_failed="`systemctl --state=failed | grep failed | cut -d \ -f 2 | tr '\n' ' '`" + fi } config=("default" "`uname -s`") @@ -78,7 +93,15 @@ case "${DOMAIN//cs.fau.de/informatik.uni-erlangen.de}" in ;; esac -PROMPT=$'%{$fg[yellow]%}%n@%{$fg[magenta]%}%m%{$reset_color%} %~ \n%{$fg[cyan]%}%T%{$reset_color%} %0(?,%{$fg[green]%},%{$fg[red]%}%s)%?%{$reset_color%} %# ' +if [[ $UID == 0 && -f `which systemctl` ]] +then + PROMPT=$'%{$fg[red]>> $systemd_failed$reset_color%}\n' +else + PROMPT="" +fi + +PROMPT+=$'%{$fg[yellow]%}%n@%{$fg[magenta]%}%m%{$reset_color%} %~ \n%{$fg[cyan]%}%T%{$reset_color%} %0(?,%{$fg[green]%},%{$fg[red]%}%s)%?%{$reset_color%} %# ' + RPROMPT='${vcs_info_msg_0_}' export DEBEMAIL='christoph@debian.org'