# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2.
-# Latest change: Son Dez 09 22:58:07 CET 2007 [mika]
+# Latest Change: Sat Jan 26 11:55:04 CET 2008
################################################################################
# source ~/.zshrc.global {{{
if [[ -z "$ZSHRC_GLOBAL_HAS_BEEN_READ" ]] ; then
print 'Warning: global zsh config has not been read.' >&2
print ' prepare for possible errors!' >&2
+ print '' >&2
+ print 'See our refcard for info on how to get the complete configuration:' >&2
+ print ' <http://grml.org/zsh/grml-zsh-refcard.pdf>' >&2
fi
# }}}
# completion system {{{
# just make sure it is loaded in this file too
+# TODO: is this *really* needed? compsys should be run in the global zshrc already.
check_com compinit || { autoload -U compinit && compinit }
# }}}
}
#f5# Get specific git diff
-git-get-plaindiff() {
+git-get-plaindiff () {
if [[ -z $GITTREE ]] ; then
- GITTREE='linux/kernel/git/torvalds/linux-2.6.git'
+ GITTREE='linux/kernel/git/torvalds/linux-2.6.git'
fi
- if ! [[ -z $1 ]] ; then
- wget "http://kernel.org/git/?p=$GITTREE;a=commitdiff_plain;h=$1" -O $1.diff
+ if [[ -z $1 ]] ; then
+ echo 'Usage: git-get-plaindiff '
else
- echo 'Usage: git-get-plaindiff '
+ echo -n "Downloading $1.diff ... "
+ # avoid "generating ..." stuff from kernel.org server:
+ wget --quiet "http://kernel.org/git/?p=$GITTREE;a=commitdiff_plain;h=$1" -O /dev/null
+ wget --quiet "http://kernel.org/git/?p=$GITTREE;a=commitdiff_plain;h=$1" -O $1.diff \
+ && echo done || echo failed
fi
}
+
# http://strcat.de/blog/index.php?/archives/335-Software-sauber-deinstallieren...html
#f5# Log 'make install' output
mmake() {
| sed 's/value=//;s/"//g'
}
+#f2# Find history events by search pattern and list them by date.
+whatwhen() {
+# {{{
+ local usage help ident format_l format_s first_char remain first last
+ usage='USAGE: whatwhen [options] <searchstring> <search range>'
+ help='Use' \`'whatwhen -h'\'' for further explanations.'
+ ident=${(l,${#${:-Usage: }},, ,)}
+ format_l="${ident}%s\t\t\t%s\n"
+ format_s="${format_l//(\\t)##/\\t}"
+ # Make the first char of the word to search for case
+ # insensitive; e.g. [aA]
+ first_char=[${(L)1[1]}${(U)1[1]}]
+ remain=${1[2,-1]}
+ # Default search range is `-100'.
+ first=${2:-\-100}
+ # Optional, just used for `<first> <last>' given.
+ last=$3
+ case $1 in
+ ("")
+ printf '%s\n\n' 'ERROR: No search string specified. Aborting.'
+ printf '%s\n%s\n\n' ${usage} ${help} && return 1
+ ;;
+ (-h)
+ printf '%s\n\n' ${usage}
+ print 'OPTIONS:'
+ printf $format_l '-h' 'show help text'
+ print '\f'
+ print 'SEARCH RANGE:'
+ printf $format_l "'0'" 'the whole history,'
+ printf $format_l '-<n>' 'offset to the current history number; (default: -100)'
+ printf $format_s '<[-]first> [<last>]' 'just searching within a give range'
+ printf '\n%s\n' 'EXAMPLES:'
+ printf ${format_l/(\\t)/} 'whatwhen grml' '# Range is set to -100 by default.'
+ printf $format_l 'whatwhen zsh -250'
+ printf $format_l 'whatwhen foo 1 99'
+ ;;
+ (\?)
+ printf '%s\n%s\n\n' ${usage} ${help} && return 1
+ ;;
+ (*)
+ # -l list results on stout rather than invoking $EDITOR.
+ # -i Print dates as in YYYY-MM-DD.
+ # -m Search for a - quoted - pattern within the history.
+ fc -li -m "*${first_char}${remain}*" $first $last
+ ;;
+ esac
+# }}}
+}
+
# change fluxbox keys from 'Alt-#' to 'Alt-F#' and vice versa
fluxkey-change() {
[[ -n "$FLUXKEYS" ]] || local FLUXKEYS="$HOME/.fluxbox/keys"
return 1
fi
}
-
-
# }}}
# mercurial related stuff {{{