X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=d7fb9be855af566730f717060bc913b7e0cdfc31;hb=26ec56414ddaa420642dc857bfb224386632023a;hp=d142ef04346b99d48248de139cc2549a56d120e5;hpb=23c7c4da79c3253ea5f7bfcb6c55937f9866973d;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index d142ef0..d7fb9be 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -252,6 +252,7 @@ GRML_ZSH_CNF_HANDLER=${GRML_ZSH_CNF_HANDLER:-/usr/share/command-not-found/comman BATTERY=${BATTERY:-0} GRMLSMALL_SPECIFIC=${GRMLSMALL_SPECIFIC:-1} GRML_ALWAYS_LOAD_ALL=${GRML_ALWAYS_LOAD_ALL:-0} +ZSH_NO_DEFAULT_LOCALE=${ZSH_NO_DEFAULT_LOCALE:-0} if isgrmlcd ; then GRML_WARN_SKEL=${GRML_WARN_SKEL:-0} @@ -332,14 +333,20 @@ fi # GRML_WARN_SKEL # this function checks if a command exists and returns either true # or false. This avoids using 'which' and 'whence', which will # avoid problems with aliases for which on certain weird systems. :-) +# Usage: check_com [-c|-g] word +# -c only checks for external commands +# -g does the usual tests and also checks for global aliases check_com() { - local -i comonly + local -i comonly gatoo if [[ ${1} == '-c' ]] ; then (( comonly = 1 )) shift + elif [[ ${1} == '-g' ]] ; then + (( gatoo = 1 )) else (( comonly = 0 )) + (( gatoo = 0 )) fi if (( ${#argv} != 1 )) ; then @@ -360,6 +367,10 @@ check_com() { return 0 fi + if (( gatoo > 0 )) && [[ -n ${galiases[$1]} ]] ; then + return 0 + fi + return 1 } @@ -473,7 +484,9 @@ zrclocal() { #}}} # locale setup {{{ -xsource "/etc/default/locale" +if (( ZSH_NO_DEFAULT_LOCALE == 0 )); then + xsource "/etc/default/locale" +fi for var in LANG LC_ALL LC_MESSAGES ; do [[ -n ${(P)var} ]] && export $var @@ -559,6 +572,19 @@ else fi fi +# support colors in less +export LESS_TERMCAP_mb=$'\E[01;31m' +export LESS_TERMCAP_md=$'\E[01;31m' +export LESS_TERMCAP_me=$'\E[0m' +export LESS_TERMCAP_se=$'\E[0m' +export LESS_TERMCAP_so=$'\E[01;44;33m' +export LESS_TERMCAP_ue=$'\E[0m' +export LESS_TERMCAP_us=$'\E[01;32m' + +MAILCHECK=30 # mailchecks +REPORTTIME=5 # report about cpu-/system-/user-time of command if running longer than 5 seconds +watch=(notme root) # watch for everyone but me and root + # automatically remove duplicates from these arrays typeset -U path cdpath fpath manpath # }}} @@ -655,6 +681,17 @@ commit-to-history() { zle -N commit-to-history bindkey "^x^h" commit-to-history +# only slash should be considered as a word separator: +slash-backward-kill-word() { + local WORDCHARS="${WORDCHARS:s@/@}" + # zle backward-word + zle backward-kill-word +} +zle -N slash-backward-kill-word + +#k# Kill everything in a word up to its last \kbd{/} +bindkey '\ev' slash-backward-kill-word + # }}} # a generic accept-line wrapper {{{ @@ -865,8 +902,8 @@ alias run-help >&/dev/null && unalias run-help zrcautoload run-help # use via 'esc-h' # completion system -if zrcautoload compinit && compinit 2>/dev/null ; then - compinit 2>/dev/null || print 'Notice: no compinit available :(' +if zrcautoload compinit ; then + compinit || print 'Notice: no compinit available :(' else print 'Notice: no compinit available :(' function zstyle { } @@ -999,21 +1036,6 @@ setopt nobeep # avoid "beep"ing setopt pushd_ignore_dups # don't push the same dir twice. setopt noglobdots # * shouldn't match dotfiles. ever. -MAILCHECK=30 # mailchecks -REPORTTIME=5 # report about cpu-/system-/user-time of command if running longer than 5 seconds -watch=(notme root) # watch for everyone but me and root - -# only slash should be considered as a word separator: -slash-backward-kill-word() { - local WORDCHARS="${WORDCHARS:s@/@}" - # zle backward-word - zle backward-kill-word -} -zle -N slash-backward-kill-word - -#k# Kill everything in a word up to its last \kbd{/} -bindkey '\ev' slash-backward-kill-word - # }}} # {{{ history @@ -2214,8 +2236,7 @@ alias term2iso="echo 'Setting terminal to iso mode' ; print -n '\e%@'" alias term2utf="echo 'Setting terminal to utf-8 mode'; print -n '\e%G'" # make sure it is not assigned yet -[[ $(whence -w utf2iso &>/dev/null) == 'utf2iso: alias' ]] && unalias utf2iso - +[[ -n ${aliases[utf2iso]} ]] && unalias utf2iso utf2iso() { if isutfenv ; then for ENV in $(env | command grep -i '.utf') ; do @@ -2225,7 +2246,7 @@ utf2iso() { } # make sure it is not assigned yet -[[ $(whence -w iso2utf &>/dev/null) == 'iso2utf: alias' ]] && unalias iso2utf +[[ -n ${aliases[iso2utf]} ]] && unalias iso2utf iso2utf() { if ! isutfenv ; then for ENV in $(env | command grep -i '\.iso') ; do @@ -2604,7 +2625,8 @@ grmlcomp() { # 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 tail head feh cp mv df stow uname ipacsum fetchipac; do + for compcom in cp deborphan df feh fetchipac head hnb ipacsum mv \ + pal stow tail uname ; do [[ -z ${_comps[$compcom]} ]] && compdef _gnu_generic ${compcom} done; unset compcom @@ -3210,11 +3232,6 @@ check_com -c python && alias http="python -m SimpleHTTPServer" # Use 'g' instead of 'git': check_com g || alias g='git' -# use colors when browsing man pages, but only if not using LESS_TERMCAP_* from /etc/zsh/zshenv: -if [[ -z "$LESS_TERMCAP_md" ]] ; then - [[ -d ~/.terminfo/ ]] && alias man='TERMINFO=~/.terminfo/ LESS=C TERM=mostlike PAGER=less man' -fi - # check whether Debian's package management (dpkg) is running if check_com salias ; then #a2# Check whether a dpkg instance is currently running @@ -3414,11 +3431,8 @@ greph() { history 0 | grep $1 } #a2# Execute \kbd{grep -i -{}-color=auto} alias GREP='grep -i --color=auto' -# one blank line between each line -if [[ -r ~/.terminfo/m/mostlike ]] ; then - #f5# Watch manpages in a stretched style - man2() { PAGER='dash -c "sed G | /usr/bin/less"' TERM=mostlike /usr/bin/man "$@" ; } -fi +#f5# Watch manpages in a stretched style +man2() { PAGER='dash -c "sed G | /usr/bin/less"' command man "$@" ; } # d():Copyright 2005 Nikolai Weibull # note: option AUTO_PUSHD has to be set