## ## ~/.zshrc ## ## ## Nicolas Bareil (nbareil@mouarf.org) - http://mouarf.org/ ## trap clear EXIT path=(~/.slash/bin/ ~/bin/servers/ ~/bin /usr/local/bin /usr/bin /bin /usr/bin/X11 /usr/games /sbin/ /usr/sbin/ ~/bin/j2sdk/bin) manpath=(~/bin/man /usr/man /usr/share/man /usr/local/man /usr/X11R6/man/) export LD_LIBRARY_PATH=${HOME}/.slash/lib # print the time used by a program if it took more than # $REPORTIME ms of CPU time export REPORTTIME=5 # Filename suffixes to ignore during completion fignore=(.o ~ .old .bak .tmp .swp) # CVS variables export CVS_RSH=ssh export CVSEDITOR=vim export CVSROOT=:ext:nbareil@plop.dyndns.org:/var/lib/cvs # quelques options spécifiques à zsh setopt notify correct pushdtohome cdablevars autolist # globdots setopt correctall autocd longlistjobs setopt autoresume histignoredups pushdsilent noclobber setopt autopushd pushdminus extendedglob rcquotes mailwarning setopt autonamedirs transientrprompt shortloops # faire la complétion sur ./configure --prefix= setopt magic_equal_subst unsetopt bgnice autoparamslash # completer au milieu des mots en tenant compte des deux cotes setopt completeinword # configuration de la complétion zstyle ':completion:*' use-cache on zstyle ':completion:*' cache-path ~/.zshd/cache zstyle ':completion:functions' ignored-patterns '_*' zstyle ':completion:*:*:kill' insert-ids single compctl -g '*(-/)' cd pushd compctl -g '*(/)' rmdir dircmp compctl -j -P % -x 's[-] p[1]' -k signals -- kill compctl -j -P % fg bg wait jobs disown compctl -A shift compctl -caF type whence which compctl -F unfunction compctl -a unalias compctl -v unset typeset declare vared readonly export integer compctl -e disable compctl -d enable # Some nice key bindings bindkey '^X^A' vi-find-prev-char-skip bindkey -e # emacs key bindings bindkey ' ' magic-space # also do history expansion on space bindkey '^F' history-beginning-search-backward bindkey '\ek' backward-kill-line bindkey '\eq' push-input # M-v will print a globbing pattern for all videos formats known bindkey -s '\eV' '*.{$(perl -lane ''push @x, $F[1] if /video/ && defined $F[1];END{print join ",",@x} '' /etc/mime.types)}(.N)' # under Xterm bindkey '^[[1;5D' backward-word bindkey '^[[1;5C' forward-word bindkey '^[Od' backward-word bindkey '^[Oc' forward-word # Désactivation du bip désagréable de complétion #xset b off 2> /dev/null # Historique export SAVEHIST=100000 export HISTSIZE=100000 setopt histignorespace histexpiredupsfirst SHARE_HISTORY setopt histsavenodups nohistbeep EXTENDED_HISTORY export DIRSTACKSIZE=20 # Autorise les redirections E/S multiples setopt multios # Permet l'extension des regexps setopt EXTENDED_GLOB # Interprete foo/bar comme $foo/bar si $foo existe setopt cdablevars setopt nonotify # La portée des variables ne depasse pas celle des fonctions (comme en C) setopt localoptions localtraps # Appel des fonctions autoload -U compinit; compinit # {a-z} : expansion into a, b, c, d, e, f,...,z setopt braceccl declare -U fpath fpath=(~/.zshd/zfunc/ $fpath /usr/share/zsh-beta/$ZSH_VERSION/functions/Prompts) PS1='%B%(?..[%?] )%b%m%# ' RPS1='%B%3~%b' autoload -U colors zcalc zmv autoload -U -- ~/.zshd/zfunc/*~_*(.:t) # when history-search failed, you press M-e and you can manually # complete your command. # # from Bart Schaefer # http://article.gmane.org/gmane.comp.shells.zsh.devel:5372 copy-search-as-buffer() { zle end-of-history; BUFFER="$LASTSEARCH" } zle -N copy-search-as-buffer bindkey '\ee' copy-search-as-buffer # from Atom 'Smasher' # http://article.gmane.org/gmane.comp.shells.zsh.devel:5405 precmd () { print -n '\017' } for i in ~/.etc/zsh/screen-title.zsh \ ~/.etc/alias \ ~/.etc/zsh/keep-last-ouput.zsh; do [ -e "$i" ] && source "$i" done hosts=(`hostname` jesors.wlan.mouarf.org mouarf.org \ guagua.wlan.mouarf.org guagua.priv.mouarf.org guagua \ localhost madchat.org plop.dyndns.org dune2.info \ 82.236.102.12 plop.priv.mouarf.org plop.mouarf.org plop.dyndns.org) # Peter Stephenson http://article.gmane.org/gmane.comp.shells.zsh.devel:6622 zstyle ':completion:*' hosts ${${(f)"$(<~/.ssh/known_hosts)"}%%[[:space:],]*} [ -d ~/.zshd/cache ] && zstyle ':completion:*' cache-path ~/.zshd/cache # Coloring the ls's output eval $(dircolors --sh ~/.etc/colors) export HISTFILE=$HOME/.zshd/history ## échapper tous les caractères réservés au shell lorsqu'il s'agit ## d'une URL en ligne de commande. autoload -U url-quote-magic; zle -N self-insert url-quote-magic zstyle -e :urlglobber url-other-schema \ '[[ $words[1] == scp ]] && reply=("*") || reply=(http https ftp)' ## rajouter sudo a la ligne de commande et l'accepter zle -N sudoify-command-and-accept-line zle -N sudoify-command bindkey '\er' sudoify-command-and-accept-line bindkey '\eR' sudoify-command ## repeter le dernier mot de la ligne de commande zle -N copiteur bindkey '\el' copiteur #export videos="(#i)*($(perl -lane 'push @x, $F[1] if /video/ && defined $F[1];END{print join q/|/,@x}' /etc/mime.types))" # export videos=''(#i)*(${(j:|:)${(z)${(fR)${(M)${(f)"$(< /etc/mime.types)"}##video*}##video[[:alnum:]./-]##[\t ]#}}})'' #export extensions=''${(j:|:)${(z)${(fR)${(M)${(f)"$(< /etc/mime.types)"}##video*}##video[[:alnum:]./-]##[\t ]#}}}'' #export videos="(#i)*($extensions)" export extensions=''${(fR)${(M)${(f)"$(< /etc/mime.types)"}##video*}##video[[:alnum:]./-]##[\t ]#}'' export videos="(#i)*(${(j:|:)${(z)extensions}})"