# $Id: zshrc,v 1.50 2009/05/01 13:52:41 winfried Exp $ bindkey -e setopt correct setopt nohup setopt hash_list_all setopt auto_cd setopt multios # Automatycznie wrzuca listę katalogów w których byłem # Bardzo wygodne z dirs -v setopt auto_pushd setopt pushd_ignore_dups # bash-style line editing autoload -U select-word-style select-word-style bash # ctrl-litera porusza się po całym wyrazie. bindkey "^f" emacs-forward-word bindkey "^b" emacs-backward-word bindkey "^w" backward-delete-word # to chcę mieć wszędzie alias scx="screen -rd" alias dv="dirs -v" alias ssr="ssh -lroot" alias svim="screen vim" # Utilsy do RCS: alias ciww="ci -u -wwinfried" ciwinit() { if [[ -z "$1" ]]; then return 1 fi ci -u -wwinfried $1 rcs -U $1 chmod u+w $1 } # jebane Linuxy if [[ $OSTYPE = freebsd* ]]; then psaux() { ps -aux } alias ls="ls -GF" alias ll="ls -laGF" alias lsmod="kldstat" llast() { if [ -n "$1" ]; then for i in ~log/wtmp ~log/archive/wtmp*; do last -f $i $1; done; fi } hash -d rcd="/usr/local/etc/rc.d" hash -d letc="/usr/local/etc" elif [[ $OSTYPE = linux* ]]; then psaux() { ps -aux } alias ls="ls -F --color=auto" alias ll="ls -laF --color=auto" alias kldstat="lsmod" elif [[ $OSTYPE = solaris* ]]; then psaux() { ps -Af } # Głupi Solaris nie umi kolorków alias ls="ls -F" alias ll="ls -laF" fi alias ssh="ssh -o'Protocol 2,1'" # katalogi smieszne: hash -d log=/var/log # na konsoli nie chcę bajerów PROMPT='%{%}[%D{%H:%M}]%{%} %m%{%}:%{%}%{%}%35<...<%{%}%~ %(?..%{%}(%?%)%{%} )%(2L.%{%}.%{%})%(!.#.$)%{%} ' if [[ $TERM = rxvt || $TERM = *xterm* || $TERM = aterm || $TERM = Eterm ]]; then PROMPT='%{]0;%n@%m%}'"$PROMPT" else fi # historia: HISTFILE=${HOME}/.zsh_history HISTSIZE=5000 SAVEHIST=5000 setopt hist_ignore_dups setopt hist_expire_dups_first setopt hist_ignore_space setopt hist_no_store setopt inc_append_history setopt extended_history setopt hist_reduce_blanks # Usuwanie niepotrzebnych slashy i innych takich. setopt auto_remove_slash # completion "w środku" wyrazu setopt complete_in_word # zaawansowane globy setopt extendedglob ########################################################## # # completion zmodload -i zsh/complist # Jeśli więcej niż 4 elementy, to rozwijać menu. zstyle ':completion:*' menu select=4 autoload -U compinit compinit # Kolorowa lista. zstyle ':completion:*' list-colors '' # RCC . ${HOME}/.zsh_rcc # completion do ssh po hostach w known_hosts, poprawione local _myhosts if [ -f "$HOME/.ssh/known_hosts" ]; then _myhosts=( ${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*} ) zstyle ':completion:*(scp|ssh):*' hosts $_myhosts fi local _myusers _myusers=( 'winfried' 'root' ) zstyle ':completion:*:(scp|ssh):*' users $_myusers ################################################## # rulezujemy zstyle ':completion:*:*:(cvsup|csup):*:*' file-patterns \ '/etc/*-supfile:global-supfiles' '*-supfile:local-supfiles' # Dopuszczalna liczba pomyłek, oryginalny (błędny) string też w liście. zstyle ':completion:*' max-errors 1 zstyle ':completion:*' original true zstyle ':completion:*' completer _complete _correct _approximate # nowe bajery: autoload -U insert-files zle -N insert-files bindkey "^Xf" insert-files ## C-x-f # Predykcja. Jest zajebiście magiczna. autoload -U predict-on zle -N predict-on zle -N predict-off bindkey "^X^Z" predict-on ## C-x C-z bindkey "^Z" predict-off ## C-z autoload -U zmv # Informuje o czasie pracy procesów, które działają dłużej niż: REPORTTIME=10 # Nazwy procesów brać z 'ps' zstyle ':completion:*:processes' command 'psaux' # jakieś lokalne śmieci if [ -r ${HOME}/.zshrc_local ]; then . ${HOME}/.zshrc_local fi