X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=c38176afc64cb6ff96afeedee8cea2b2e28c0480;hb=fbb9d8dd636b098ba25558cfef0886ed10181028;hp=acf9072dfedbad9123f3457de6c1f59e8876f1bd;hpb=3d6452fdfc44310b5615eaf61c95cab4c27d9bf8;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index acf9072..c38176a 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/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: Don Nov 22 11:13:15 CET 2007 [mika] +# Latest change: Sam Dez 22 19:17:27 CET 2007 [mika] ################################################################################ # This file is sourced only for interactive shells. It # should contain commands to set up aliases, functions, @@ -116,10 +116,10 @@ check_com() { return 1 fi - if [[ -n ${commands[$1]} ]] \ - || [[ -n ${functions[$1]} ]] \ - || [[ -n ${aliases[$1]} ]] \ - || [[ -n ${reswords[$1]} ]] ; then + if [[ -n ${commands[$1]} ]] \ + || [[ -n ${functions[$1]} ]] \ + || [[ -n ${aliases[$1]} ]] \ + || [[ -n ${reswords[(r)$1]} ]] ; then return 0 fi @@ -570,8 +570,21 @@ if is4 && autoload -U edit-command-line && zle -N edit-command-line ; then bindkey '\ee' edit-command-line fi -#k# menu selection: pick item but stay in the menu -is4 && bindkey -M menuselect '\e^M' accept-and-menu-complete +if is4 && [[ -n ${(k)modules[zsh/complist]} ]] ; then + #k# menu selection: pick item but stay in the menu + bindkey -M menuselect '\e^M' accept-and-menu-complete + + # use the vi navigation keys (hjkl) besides cursor keys in menu completion + #bindkey -M menuselect 'h' vi-backward-char # left + #bindkey -M menuselect 'k' vi-up-line-or-history # up + #bindkey -M menuselect 'l' vi-forward-char # right + #bindkey -M menuselect 'j' vi-down-line-or-history # bottom + + # accept a completion and try to complete again by using menu + # completion; very useful with completing directories + # by using 'undo' one's got a simple file browser + bindkey -M menuselect '^o' accept-and-infer-next-history +fi # press "ctrl-e d" to insert the actual date in the form yyyy-mm-dd _bkdate() { BUFFER="$BUFFER$(date '+%F')"; CURSOR=$#BUFFER; } @@ -850,9 +863,8 @@ is4 && [[ -z $NOPRECMD ]] && \ preexec () { [[ -n $NOPRECMD ]] && return 0 # set hostname if not running on host with name 'grml' - local HOSTNAME=$(hostname) - if [[ "$HOSTNAME" != grml ]] ; then - NAME="@$HOSTNAME" + if [[ "$HOSTNAME" != $(hostname) ]] ; then + NAME="@$HOSTNAME" fi # get the name of the program currently running and hostname of local machine # set screen window title if running in a screen @@ -1013,21 +1025,20 @@ iso2utf() { } # set up software synthesizer via speakup -# TODO: make this a function? -alias swspeak=' - aumix -w 90 -v 90 -p 90 -m 90 - if ! [[ -r /dev/softsynth ]] ; then - flite -o play -t "Sorry, software synthesizer not available. Did you boot with swspeak bootoption?" - return 1 - else - setopt singlelinezle - unsetopt prompt_cr - export PS1="%m%# " - nice -n -20 speechd-up - sleep 2 - flite -o play -t "Finished setting up software synthesizer" - fi -' +swspeak() { + aumix -w 90 -v 90 -p 90 -m 90 + if ! [[ -r /dev/softsynth ]] ; then + flite -o play -t "Sorry, software synthesizer not available. Did you boot with swspeak bootoption?" + return 1 + else + setopt singlelinezle + unsetopt prompt_cr + export PS1="%m%# " + nice -n -20 speechd-up + sleep 2 + flite -o play -t "Finished setting up software synthesizer" + fi +} # I like clean prompt, so provide simple way to get that check_com 0 || alias 0='return 0' @@ -1213,6 +1224,7 @@ limit -s # called later (via is4 && grmlcomp) # notice: use 'zstyle' for getting current settings # press ^Xh (control-x h) for getting tags in context; ^X? (control-x ?) to run complete_debug with trace output +# TODO: make grmlcomp() readable. :-) grmlcomp() { ## completion system ## no initial indention in grmlcomp(), the lines are long enough already. @@ -1243,6 +1255,12 @@ zstyle ':completion:*:options' description 'yes' # des zstyle ':completion:*:processes' command 'ps -au$USER' # on processes completion complete all user processes zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters # offer indexes before parameters in subscripts zstyle ':completion:*' verbose true # provide verbose completion information + +# recent (as of Dec 2007) zsh versions are able to provide descriptions +# for commands (read: 1st word in the line) that it will list for the user +# to choose from. The following disables that, because it's not exactly fast. +zstyle ':completion:*:-command-:*:' verbose false + zstyle ':completion:*:warnings' format $'%{\e[0;31m%}No matches for:%{\e[0m%} %d' # set format for warnings zstyle ':completion:*:*:zcompile:*' ignored-patterns '(*~|*.zwc)' # define files to ignore for zcompile zstyle ':completion:correct:' prompt 'correct to: %e' # @@ -1748,4 +1766,4 @@ ZSHRC_GLOBAL_HAS_BEEN_READ=1 # }}} ## END OF FILE ################################################################# -# vim:foldmethod=marker expandtab +# vim:filetype=zsh foldmethod=marker autoindent expandtab shiftwidth=4