]> git.siccegge.de Git - dotfiles/zsh.git/blobdiff - zshrc
Add Makefile
[dotfiles/zsh.git] / zshrc
diff --git a/zshrc b/zshrc
index 64ad4eaceb21954fb67ff78829269572a6b7812f..a1913d0dae223fc2115700aeeed782f6b1f02fff 100644 (file)
--- a/zshrc
+++ b/zshrc
@@ -35,11 +35,11 @@ colors
 zmodload -i zsh/complist
 
 _force_rehash() {
-    if (( CURRENT == 1 )); then
-        rehash
-    fi
-    # We didn't really complete anything.
-    return 1
+       if (( CURRENT == 1 )); then
+               rehash
+       fi
+       # We didn't really complete anything.
+       return 1
 }
 
 zstyle :compinstall filename '/home/christoph/.zshrc'
@@ -47,9 +47,11 @@ 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
+zstyle -e ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX + $#SUFFIX) / 3 )) )'
+zstyle ':completion:*:(^approximate):*' matcher-list 'm:{a-z}={A-Z}'
 
 bindkey -e
-bindkey '\ee' backward-word 
+bindkey '\ee' backward-word
 bindkey '\ef' forward-word
 bindkey '\e[B' down-line-or-search
 bindkey '\e[A' up-line-or-search
@@ -58,18 +60,18 @@ bindkey '\e[28~' run-help
 
 
 setWindowTitle(){
-    echo -e '\033]0;'$1'\007'
+       echo -e '\033]0;'$1'\007'
 }
 
 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
+       vcs_info
+       setWindowTitle ${USER}@${HOST}
+
+       if [[ $UID == 0 && $+commands[systemctl] != 0 ]]
+       then
+         use_systemd=true
+         systemd_failed="`systemctl --state=failed | grep failed | cut -d \  -f 2 | tr '\n' ' '`"
+       fi
 }
 
 config=("default" "`uname -s`")
@@ -80,11 +82,11 @@ case "${DOMAIN//cs.fau.de/informatik.uni-erlangen.de}" in
                config=($config debian)
                ;;
        (faui49*.uni-erlangen.de)
-        export EMAIL=Christoph.Egger@cs.fau.de
+               export EMAIL=Christoph.Egger@cs.fau.de
                config=($config i4lab)
                ;;
        (faui0*.informatik.uni-erlangen.de|faui48*.informatik.uni-erlangen.de)
-           export EMAIL=siccegge@cs.fau.de
+               export EMAIL=siccegge@cs.fau.de
                config=($config cip)
                ;;
        (*.siccegge.de)
@@ -93,7 +95,7 @@ case "${DOMAIN//cs.fau.de/informatik.uni-erlangen.de}" in
                ;;
 esac
 
-if [[ $UID == 0  && -f `which systemctl` ]]
+if [[ $UID == 0 && $+commands[systemctl] != 0 ]]
 then
   PROMPT=$'%{$fg[red]>>  $systemd_failed$reset_color%}\n'
 else
@@ -120,7 +122,13 @@ do
        done
 done
 
-
+for location in $config
+do
+       if [ -d ~/.zsh/functions/${location}/ ]
+       then
+               fpath=( ~/.zsh/functions/${location}/ $fpath )
+       fi
+done
 
 karma () {
        gpg --fingerprint $1 >> ${HOME}/karma
@@ -128,19 +136,24 @@ karma () {
 }
 
 gpgrefresh () {
-    gpg --refresh-keys 2>&1 | grep -v 'nicht geändert'
+       gpg --refresh-keys 2>&1 | grep -v 'nicht geändert'
 }
 
 sponsor() {
-    pkgname=`echo $i | rcut -d '/' -f 1  | cut -d '_' -f 1`
-    apt-get --download-only -t unstable $pkgname
-    dget $i
+       pkgname=`echo $i | rcut -d '/' -f 1  | cut -d '_' -f 1`
+       apt-get --download-only -t unstable $pkgname
+       dget $i
 }
 
 path=(${HOME}/bin $path)
-fpath=(${HOME}/.zsh/functions/$CONFIG ${HOME}/.zsh/functions/default $fpath)
-
 export PATH
 export FPATH
 
 alias wb="ssh -t buildd.debian.org wb"
+
+# remove word, not including /
+function _backward_kill_default_word() {
+  WORDCHARS='*?_-.[]~=&;!#$%^(){}<>' zle backward-kill-word
+}
+zle -N backward-kill-default-word _backward_kill_default_word
+bindkey -e '\e=' backward-kill-default-word