[[ -n ${(P)var} ]] && export $var
done
-xsource "/etc/sysconfig/keyboard"
-
-TZ=$(xcat /etc/timezone)
-
# set some variables
if check_com -c vim ; then
#v#
fi
# completion system
+COMPDUMPFILE=${COMPDUMPFILE:-${ZDOTDIR:-${HOME}}/.zcompdump}
if zrcautoload compinit ; then
- compinit || print 'Notice: no compinit available :('
+ compinit -d ${COMPDUMPFILE} || print 'Notice: no compinit available :('
else
print 'Notice: no compinit available :('
function compdef { }
# use generic completion system for programs not yet defined; (_gnu_generic works
# with commands that provide a --help option with "standard" gnu-like output.)
- for compcom in cp deborphan df feh fetchipac head hnb ipacsum mv \
+ for compcom in cp deborphan df feh fetchipac gpasswd head hnb ipacsum mv \
pal stow tail uname ; do
[[ -z ${_comps[$compcom]} ]] && compdef _gnu_generic ${compcom}
done; unset compcom
zle -N Accept-Line
zle -N Accept-Line-HandleContext
-# power completion - abbreviation expansion
# power completion / abbreviation expansion / buffer expansion
# see http://zshwiki.org/home/examples/zleiab for details
# less risky than the global aliases but powerful as well
-# just type the abbreviation key and afterwards ',.' to expand it
+# just type the abbreviation key and afterwards 'ctrl-x .' to expand it
declare -A abk
setopt extendedglob
setopt interactivecomments
bind2maps viins vicmd -- Right vi-forward-char
bind2maps viins vicmd -- Right vi-forward-char
#k# Display list of abbreviations that expand when followed by ,.
-bind2maps emacs viins -- -s ',.' zleiab
+bind2maps emacs viins -- -s '^x.' zleiab
bind2maps emacs viins -- -s '^xb' help-show-abk
bind2maps emacs viins -- -s '^xM' inplaceMkDirs
#k# display help for keybindings and ZLE
fi
chpwd() {
+ if (( $DIRSTACKSIZE <= 0 )) || [[ -z $DIRSTACKFILE ]]; then return; fi
local -ax my_stack
my_stack=( ${PWD} ${dirstack} )
if is42 ; then
vcs '0'
)
+function grml_theme_has_token () {
+ if (( ARGC != 1 )); then
+ printf 'usage: grml_theme_has_token <name>\n'
+ return 1
+ fi
+ (( ${+grml_prompt_token_default[$1]} ))
+}
+
function GRML_theme_add_token_usage () {
cat <<__EOF__
Usage: grml_theme_add_token <name> [-f|-i] <token/function> [<pre> <post>]
return value is expected in the \$REPLY parameter. The use of these
options is mutually exclusive.
+ There is a utility function \`grml_theme_has_token', which you can use
+ to test if a token exists before trying to add it. This can be a guard
+ for situations in which a \`grml_theme_add_token' call may happen more
+ than once.
+
Example:
To add a new token \`day' that expands to the current weekday in the
shift 2
fi
- if (( ${+grml_prompt_token_default[$name]} )); then
+ if grml_theme_has_token $name; then
printf '
grml_theme_add_token: Token `%s'\'' exists! Giving up!\n\n' $name
GRML_theme_add_token_usage
for it in "${items[@]}"; do
zstyle -s ":prompt:${grmltheme}:${lr}:items:$it" pre apre \
|| apre=${grml_prompt_pre_default[$it]}
- zstyle -s ":prompt:grml:${grmltheme}:${lr}:$it" post apost \
+ zstyle -s ":prompt:${grmltheme}:${lr}:items:$it" post apost \
|| apost=${grml_prompt_post_default[$it]}
zstyle -s ":prompt:${grmltheme}:${lr}:items:$it" token new \
|| new=${grml_prompt_token_default[$it]}
# do we have GNU ls with color-support?
if [[ "$TERM" != dumb ]]; then
- #a1# List files with colors (\kbd{ls -b -CF \ldots})
- alias ls='ls -b -CF '${ls_options:+"${ls_options[*]}"}
+ #a1# List files with colors (\kbd{ls -CF \ldots})
+ alias ls='ls -CF '${ls_options:+"${ls_options[*]}"}
#a1# List all files, with colors (\kbd{ls -la \ldots})
alias la='ls -la '${ls_options:+"${ls_options[*]}"}
#a1# List files with long colored list, without dotfiles (\kbd{ls -l \ldots})
#a1# List files with long colored list, append qualifier to filenames (\kbd{ls -lF \ldots})\\&\quad(\kbd{/} for directories, \kbd{@} for symlinks ...)
alias l='ls -lF '${ls_options:+"${ls_options[*]}"}
else
- alias ls='ls -b -CF'
+ alias ls='ls -CF'
alias la='ls -la'
alias ll='ls -l'
alias lh='ls -hAl'
#f1# List symlinks in detail (more detailed version of 'readlink -f' and 'whence -s')
sll() {
[[ -z "$1" ]] && printf 'Usage: %s <file(s)>\n' "$0" && return 1
+ local file
for file in "$@" ; do
while [[ -h "$file" ]] ; do
ls -l $file
# PAGER='less -Mr' - If so, the use of $PAGER here needs fixing
# with respect to wordsplitting. (ie. ${=PAGER})
if check_com -c $PAGER ; then
- #f3# View Debian's changelog of a given package
+ #f3# View Debian's changelog of given package(s)
dchange() {
emulate -L zsh
- if [[ -r /usr/share/doc/$1/changelog.Debian.gz ]] ; then
- $PAGER /usr/share/doc/$1/changelog.Debian.gz
- elif [[ -r /usr/share/doc/$1/changelog.gz ]] ; then
- $PAGER /usr/share/doc/$1/changelog.gz
- else
- if check_com -c aptitude ; then
- echo "No changelog for package $1 found, using aptitude to retrieve it."
- if isgrml ; then
- aptitude -t unstable changelog $1
+ [[ -z "$1" ]] && printf 'Usage: %s <package_name(s)>\n' "$0" && return 1
+
+ local package
+ for package in "$@" ; do
+ if [[ -r /usr/share/doc/${package}/changelog.Debian.gz ]] ; then
+ $PAGER /usr/share/doc/${package}/changelog.Debian.gz
+ elif [[ -r /usr/share/doc/${package}/changelog.gz ]] ; then
+ $PAGER /usr/share/doc/${package}/changelog.gz
+ elif [[ -r /usr/share/doc/${package}/changelog ]] ; then
+ $PAGER /usr/share/doc/${package}/changelog
+ else
+ if check_com -c aptitude ; then
+ echo "No changelog for package $package found, using aptitude to retrieve it."
+ aptitude changelog "$package"
+ elif check_com -c apt-get ; then
+ echo "No changelog for package $package found, using apt-get to retrieve it."
+ apt-get changelog "$package"
else
- aptitude changelog $1
+ echo "No changelog for package $package found, sorry."
fi
- else
- echo "No changelog for package $1 found, sorry."
- return 1
fi
- fi
+ done
}
_dchange() { _files -W /usr/share/doc -/ }
compdef _dchange dchange
}
fi
-# make a backup of a file
-bk() {
- cp -a "$1" "${1}_$(date --iso-8601=seconds)"
-}
-
ssl_hashes=( sha512 sha256 sha1 md5 )
for sh in ${ssl_hashes}; do
check_com new || alias new=modified
# use colors when GNU grep with color-support
-#a2# Execute \kbd{grep -{}-color=auto}
-(( $#grep_options > 0 )) && alias grep='grep '${grep_options:+"${grep_options[*]}"}
+if (( $#grep_options > 0 )); then
+ o=${grep_options:+"${grep_options[*]}"}
+ #a2# Execute \kbd{grep -{}-color=auto}
+ alias grep='grep '$o
+ alias egrep='egrep '$o
+ unset o
+fi
# Translate DE<=>EN
# 'translate' looks up fot a word in a file with language-to-language