X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fskel%2F.zshrc;h=10f900e0c5c59c98a5dc9298306bb50b3579c50a;hb=ff188f766824a9d383191b608a402318bdb3b64d;hp=ebe54feae2ac618f753bf04f8d3b3972a1b90ae6;hpb=f6169af32ab0704dc19c90f82b9755e5375bc417;p=grml-etc-core.git diff --git a/etc/skel/.zshrc b/etc/skel/.zshrc index ebe54fe..10f900e 100644 --- a/etc/skel/.zshrc +++ b/etc/skel/.zshrc @@ -3,7 +3,7 @@ # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. -# Latest change: Sam Mai 12 23:22:28 CEST 2007 [mika] +# Latest change: Don Mai 31 17:19:00 CEST 2007 [mika] ################################################################################ # source ~/.zshrc.global {{{ @@ -15,6 +15,17 @@ fi # }}} +# check whether global file has been read {{{ + if [ -z "$ZSHRC_GLOBAL_HAS_BEEN_READ" ] ; then + print 'Warning: global zsh config has not been read'>&2 + fi +# }}} + +# autoloading stuff {{{ +# associate types and extensions (be aware with perl scripts and anwanted behaviour!) +# type zsh-mime-setup &>/dev/null || { autoload zsh-mime-setup && zsh-mime-setup } +# }}} + # completion system {{{ # just make sure it is loaded in this file too type compinit &>/dev/null || { autoload -U compinit && compinit } @@ -152,6 +163,8 @@ # some useful aliases alias md='mkdir -p' + [ -x $(which ipython) ] && alias ips='ipython -p sh' + # console stuff alias cmplayer='mplayer -vo fbdev' alias fbmplayer='mplayer -vo fbdev -fs -zoom' @@ -166,19 +179,21 @@ [ -d ~/.terminfo/ ] && alias man='TERMINFO=~/.terminfo/ LESS=C TERM=mostlike PAGER=less man' # check whether Debian's package management (dpkg) is running - salias check_dpkg_running="dpkg_running" + type salias &>/dev/null && salias check_dpkg_running="dpkg_running" # work around non utf8 capable software in utf environment - if [ -x /usr/bin/mrxvt ] ; then - isutfenv && [ -n "$LANG" ] && alias mrxvt="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} mrxvt" - fi - - if [ -x /usr/bin/aterm ] ; then - isutfenv && [ -n "$LANG" ] && alias aterm="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} aterm" - fi - - if [ -x /usr/bin/centericq ] ; then - isutfenv && [ -n "$LANG" ] && alias centericq="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} centericq" + if type isutfenv &>/dev/null ; then + if [ -x $(which mrxvt) ] ; then + isutfenv && [ -n "$LANG" ] && alias mrxvt="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} mrxvt" + fi + + if [ -x $(which aterm) ] ; then + isutfenv && [ -n "$LANG" ] && alias aterm="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} aterm" + fi + + if [ -x $(which centericq) ] ; then + isutfenv && [ -n "$LANG" ] && alias centericq="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} centericq" + fi fi # }}} @@ -237,7 +252,7 @@ # Function Usage: doc packagename doc() { cd /usr/share/doc/$1 && ls } _doc() { _files -W /usr/share/doc -/ } - compdef _doc doc + type compdef &>/dev/null && compdef _doc doc # make screenshot of current desktop (use 'import' from ImageMagic) sshot() { @@ -864,7 +879,7 @@ # hl() highlighted less # http://ft.bewatermyfriend.org/comp/data/zsh/zfunct.html - if [[ -x $(which highlight) ]] ; then + if [ -x $(which highlight) ] ; then function hl() { local theme lang theme=${HL_THEME:-""} @@ -934,6 +949,26 @@ | sed 's/value=//;s/"//g' } +# change fluxbox keys from 'Alt-#' to 'Alt-F#' and vice versa + fluxkey-change() { + [ -n "$FLUXKEYS" ] || local FLUXKEYS="$HOME/.fluxbox/keys" + if ! [ -r "$FLUXKEYS" ] ; then + echo "Sorry, \$FLUXKEYS file $FLUXKEYS could not be read - nothing to be done." + return 1 + else + if grep -q 'Mod1 F[0-9] :Workspace [0-9]' $FLUXKEYS ; then + echo -n 'Switching to Alt-# mode in ~/.fluxbox/keys: ' + sed -i -e 's|^\(Mod[0-9]\+[: space :]\+\)F\([0-9]\+[: space :]\+:Workspace.*\)|\1\2|' $FLUXKEYS && echo done || echo failed + elif grep -q 'Mod1 [0-9] :Workspace [0-9]' $FLUXKEYS ; then + echo -n 'Switching to Alt-F# mode in ~/.fluxbox/keys: ' + sed -i -e 's|^\(Mod[0-9]\+[: space :]\+\)\([0-9]\+[: space :]\+:Workspace.*\)|\1F\2|' $FLUXKEYS && echo done || echo failed + else + echo 'Sorry, do not know what to do.' + return 1 + fi + fi + } + # }}} # mercurial related stuff {{{ @@ -1013,7 +1048,7 @@ # Work around ion/xterm resize bug. #if [ "$SHLVL" = 1 ]; then -# if [ -x `which resize 2>/dev/null` ]; then +# if [ -x $(which resize) ]; then # eval `resize