# Z-Shell Configuration File # Robert Nowotniak echo bindkey -N robkeys emacs bindkey -A robkeys main bindkey '\em' 'history-search-forward' if [ "LUBIĘ_TERMINFO!" ]; then bindkey "`echoti kf1`" Klawisz_F1 bindkey "`echoti kf2`" Klawisz_F2 bindkey "`echoti kf3`" Klawisz_F3 bindkey "`echoti kf4`" Klawisz_F4 bindkey "`echoti kf5`" psk bindkey -s "`echoti kf6`" '\eqkalk.pl\n' bindkey -s "$(echoti knp)" "\C-e |& L\n" bindkey -s "`echoti kf7`" '\eqmstat\n' bindkey -s "`echoti kf8`" '\eqTV\n' bindkey -s "`echoti kf9`" '\eq gawk '\''BEGIN{ }'\''\C-b\C-b\C-b' bindkey "`echoti kf10`" F10_xterm bindkey "`echoti kdch1`" delete-char else # Nie lubię terminfo case "$TERM" in linux) bindkey -s '\e[[A' '\eqpinfo zsh\n' bindkey -s '\e[[B' '\eqdirs -v\n' bindkey -s '\e[[C' '\eqexec ssh rob@ox1\n' bindkey -s '\e[[D' '\eqexec screen -rd\n' bindkey -s '\e[[E' psk ;; screen) bindkey -s '\eOP' '\eqpinfo zsh\n' bindkey -s '\eOQ' '\eqdirs -v\n' bindkey -s '\eOR' '\eqexec ssh rob@ox1\n' bindkey -s '\eOS' '\eqexec screen -rd\n' bindkey -s '\e[15~' psk ;; rxvt|xterm) bindkey -s '\e[11~' '\eqpinfo zsh\n' bindkey -s '\e[12~' '\eqdirs -v\n' bindkey -s '\e[13~' '\eqexec ssh rob@ox1\n' bindkey -s '\e[14~' '\eqexec screen -rd\n' bindkey -s '\e[15~' psk ;; cons25*) bindkey -s '\e[M' '\eqpinfo zsh\n' bindkey -s '\e[N' '\eqdirs -v\n' bindkey -s '\e[O' '\eqexec ssh rob@ox1\n' bindkey -s '\e[P' '\eqexec screen -rd\n' bindkey -s '\e[Q' psk ;; esac fi bindkey -s '\e.' '!*\t' # Mapowanie dla mojej nietypowej klawiatury (dodatkowe klawisze) zle -N Klawisz_F1 zle -N Klawisz_F2 zle -N Klawisz_F3 zle -N Klawisz_F4 Klawisz_F1() { if [[ "$MFK" -ne 0 ]]; then aumix -v-10 else zle push-line zle -U 'pinfo zsh ' fi } Klawisz_F2() { if [[ "$MFK" -ne 0 ]]; then aumix -v+10 else zle push-line zle -U 'dirs -v ' fi } Klawisz_F3() { if [[ "$MFK" -ne 0 ]]; then aumix -v0 else if [[ "$TERM" == "xterm" ]]; then # Zmiana rozmiaru okna echo -n "\e[8;56;120t" fi zle push-line zle -U 'exec ssh rob@ox1 ' fi } Klawisz_F4() { if [[ "$MFK" -ne 0 ]]; then aumix -v0 -w0 else zle push-line zle -U 'exec screen -rd ' fi } # Obsługa 'Multimedia Function Key' mf-key() { if [[ "$MFK" -ne 0 ]]; then MFK=0 RPS1='' zle push-line zle -R echo -n "\e[A\e[0G" zle accept-line else MFK=1 RPS1='%{%}%{%}' zle push-line zle -R echo -n "\e[A\e[0G" zle accept-line fi } zle -N mf-key bindkey '\e[R43' mf-key bindkey -s '\e[R41' "\eqegrep -ir '' *\C-b\C-b\C-b" bindkey -s '\e[R42' "\eqls -lad (#i)***/**\C-b" bindkey -s '\e[R42' "\eqfind . -iname '**'\C-b\C-b" bindkey '\e[R43\e[[A' zle_zcisz bindkey '\e[R43\e[[B' zle_podglosnij bindkey '\e[R43\e[[C' zle_wycisz zle -N zle_zcisz zle -N zle_podglosnij zle -N zle_wycisz zle_zcisz() { aumix -v-10 -w-10 } zle_podglosnij() { aumix -v+10 -w+10 } zle_wycisz() { aumix -v0 -w0 } case "${(L)OSTYPE}" in *linux*) alias ls='ls --color=auto -CF ' alias la='LC_ALL=C ls' hash -d kern=/usr/src/linux hash -d dysk2=/mnt/hdc1 ;; *bsd*) alias ls='ls -CFG' alias la='LC_ALL=C ls' hash -d kern=/usr/src/sys ;; esac hash -d zsh=/usr/share/zsh/4.0.4/functions hash -d src=/usr/src hash -d vim=/usr/src/rob/vim hash -d doc=/usr/share/doc hash -d bsd=/mnt/bsd hash -d dyskC=/mnt/hda1 hash -d gnat=/usr/lib/gcc-lib/i486-linux/2.8.1/adainclude hash -d pyth=/usr/lib/python2.3/ mesg n autoload zed setopt correctall autocd extended_glob hist_ignore_dups automenu setopt pushd_ignore_dups auto_pushd ksh_option_print list_packed setopt NO_clobber NO_prompt_cr NO_list_ambiguous share_history setopt hist_expire_dups_first hist_find_no_dups setopt hist_save_no_dups DIRSTACKSIZE=10 WATCH=notme LOGCHECK=30 WATCHFMT='%B%n%b się %(a.zalogował.wylogował) na %l z %M.' WORDCHARS='*?_-.[]~&;!#$%^(){}<>' TIMEFMT="%J total time: %E user: %U kernel: %S CPU: %P" FCEDIT=vim if [ "$TERM" != "screen" ]; then TMOUT=3600 fi HISTSIZE=1000 HISTFILE=~/.zsh_history SAVEHIST=1000 mailpath=(/var/spool/mail/${USER}\?'$USER, nadeszła wiadomość od `from|tail -n1|cut -d\ -f2`.') MAILCHECK=20 READNULLCMD=more LISTPROMPT='' MENUSELECT=0 case "$TERM" in ^(*rxvt*|*xterm*|*Eterm*) ) export LESS='-iMSF' ;; *) export LESS='-iMS' ;; esac which lesspipe >&- 2>&- && eval $(lesspipe) alias l='ls -l' alias cpan='perl -MCPAN -eshell' alias fortune='fortune /usr/share/games/fortunes /usr/share/games/fortunes/pl' alias cp='cp -i' alias mv='mv -i' alias d='du -s *|sort -n' alias v='$PAGER' alias p='print' alias README='less (#ia1)(*install*|*readme*)(.^*)' alias so='source' alias irc='scrollz' alias L='less' alias G='egrep -ia' alias H='head' alias man='LC_ALL=C man' alias slown='links http://slowniki.onet.pl' alias buduj='make -f ~/.makefile' type gawk >& /dev/null || alias gawk='awk' type emacs >& /dev/null && alias emacs='emacs -nw' SPROMPT="Czy przypadkiem pisząc '%B%R%b' nie miałeś na myśli '%B%r%b' ? " # Mój hardcore'owy prompt ! PS1='%2(L.%{%}-%{%}%L%{%}-.)'\ '%{%}<'\ '%(?.%{%}.%{%})%?'\ '%{%}'\ ',%{%}'\ '%(w.%{%}.)%5(w.%{%}.)%6(w.%{%}.)%D{%d}'\ '%{%}'\ '%(1j.,%{%}[%{%}%j%{%}].)%{%}>'\ '%{%}%y' if [ "`hostname -s`" != 'ox2' ]; then PS1="$PS1"\ '%{%}@%{%}%m' fi PS1="$PS1"\ '%{%}['\ '%{%}%T'\ '%{%}]'\ '%{%}('\ '%{%}%~'\ '%{%})'\ '%{%}%(!.#.>)%{%} ' PS2="%_%B>%b " PS3="Select%B>%b " REPORTTIME=15 # Automatyczne nadawanie nazw oknom screen'a if [[ "$TERM" == "screen" ]]; then preexec() { echo -n "\ek${1/ */}\e\\" } precmd() { echo -n "\ekzsh\e\\" } fi chpwd() { # Zmiana nazwy na belce tytułowej xterminali [[ -t 1 ]] || return case $TERM in sun-cmd) print -Pn "\e]l%~\e\\" ;; *xterm*|rxvt|(dt|k|E)term) print -Dn "\e]2;$TERM / $ZSH_NAME $ZSH_VERSION:" "$PWD" "\a" ;; esac } chpwd rev6() { host -t ptr `ipv6calc -r $*` } if [ -x "/usr/bin/dircolors" -o -x "/usr/local/bin/dircolors" ]; then eval `dircolors` eval $(echo `dircolors`| sed 's/LS_COLORS/Z&/g') fi cvs() { if [ -f "./CVS/Root" -a -r "./CVS/Root" ]; then export CVSROOT=$(cat ./CVS/Root) fi echo "CVSROOT: $CVSROOT" command cvs $* } F10_xterm() { SHLVL=$[SHLVL-1] xterm &! } zle -N F10_xterm psk() { echo "\e[K\e[G" ps auxf | gawk ' BEGIN{ pid=PROCINFO["pid"] } $2!=pid{ if ($2=='$$') { print "\033[1;32m" $0 "\033[0m" } else { print } }' zle redisplay } zle -N psk mutt(){ [[ "$TERM" == 'screen' ]] && echo -en "\ekpoczta\e\\" if [ -z "$*" ]; then command mutt -y else command mutt $* fi } unfunction mutt zmodload -i zsh/complist compctl -D -f -tn + -H 0 '' compctl -C -c -tn + -v compctl -s "$IRCNICK $IRCSERVER submarine.ath.cx" -x 'c[-1,-H]'\ -k "($(/sbin/ifconfig 2>/dev/null|mawk '/inet addr/{sub("addr:","",$2);print $2}'))"\ -- scrollz irc BitchX irssi epic compctl -g '*(^*)' + -f vim compctl -o setopt unsetopt compctl -v vared typeset export read unset compctl -s '${^fpath}/*(N:t)' autoload compctl -g '*(-/D)' + -n -P '~' + -g '*(tbz|tar.bz2|tgz|tar.gz|tar.Z)' cd compctl -g '*(/)' rmdir compctl -g '(#i)*.pdf' + -g '*(/)' acroread xpdf compctl -g '(#i)*.html' + -g '(#i)*.htm' links netscape compctl -g '(#i)*.zip' unzip compctl -g '*(.*)' strip gdb compctl -g '*(D^/)' -x 'W[1,-*r]' -/ -- rm compctl -g "(|.)(zshrc|zshenv|zlogin|zlogout|zprofile)" source compctl -g "*.(mpeg|mpg|avi|asf)" xine compctl -f -x 'W[1,-*d*]' -g '(#i)*.(tgz|gz)' -- gzip compctl -g '(#i)*.(tgz|gz)' + -f zdiff zgrep zless zmore zcat zcmp zegrep zfgrep compctl -l '' exec nohup screen nice where which type man compctl -g '(#i)*.(jpeg|jpg|bmp|png|xpm|gif)' qiv compctl -s "3ffe:8010:7:f5::1 3ffe:8010::1" ping6 compctl -g '*.(bz2|tbz)' bunzip2 compctl -a unalias compctl -g '*.(gpg|pgp|asc)(.)' -x 's[-]' -P '-' -k '( sign clearsign detach-sign encrypt symmetric store decrypt verify list-keys list-sigs check-sigs fingerprint list-secret-keys gen-key delete-key edit-key gen-revoke export import list-packets armor local-user remote-user textmode output verbose batch yes no keyring secret-keyring default-key options debug debug-all status-fd no-comment completes-needed marginals-needed load-extension rfc1991 s2k-mode s2kdigest-algo s2kcipher-algo cipher-algo digest-algo compress-algo throw-keyid)' -- gpg compctl -g '*.(adb|ads)' gnatmake echo -n " \e[36mOS\e[m\e[1m:\e[m " uname -mnrs echo -n " \e[36mUptime\e[m\e[1m:\e[m " uptime if [[ -x "$HOME/bin/do-matury" ]]; then echo -n " \e[1;31mMatura\e[m\e[1m:\e[m " do-matury | sed 's@[0123456789]@&@g' fi if [ "$TERM" != "screen" -a \( -n "$REMOTE_HOST" -o -n "$SSH_TTY" \) ]; then if [ -z "$(ps xa | awk '{print $5}' | grep '^scree[n]$')" ]; then screen else screen -drq fi fi # Uruchomienie agenta kluczy ps x | awk '{print $5}' | grep '^ssh-agen[t]$' 1>/dev/null if [ "$?" -ne 0 ]; then if [ -e "$HOME/.ssh-agent" ]; then if ! rm $HOME/.ssh-agent; then echo "Błąd: Nie dało się usunąć $HOME/.ssh-agent" return 1 fi fi ssh-agent > $HOME/.ssh-agent elif [ ! -e "$HOME/.ssh-agent" ]; then echo "Błąd: Weź się zaloguj jeszcze raz." killall ssh-agent return 1 fi echo -n " \e[36mSSH\e[m\e[1m:\e[m " eval `cat $HOME/.ssh-agent` if ! ssh-add -l >/dev/null; then ps x | awk '{print $5}' | grep '^ssh-ad[d]$' 1>/dev/null if [ "$?" -ne 0 ]; then ssh-add "$HOME/.ssh/smallkey" fi fi case "`date +%u`" in 5|6|7) if [[ ! -e $HOME/.automat/jest-weekend ]]; then echo "\n\t\t\t\e[1mWreszcie weekend, uśmiechnij się.\n\t\t\t\tMiłego wypoczynku, $USER.\e[0m" touch $HOME/.automat/jest-weekend 2>/dev/null 1>&2 fi ;; *) rm -f $HOME/.automat/jest-weekend 2>/dev/null 1>&2 ;; esac echo source "$HOME/.automat/zsh-cd-plugin" source "$HOME/.automat/mount"