X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=cd1a220083a0765a02cccb36036c2d49147acb56;hb=5d0b338555c8eadf95e54c41aeca4cccb9779384;hp=f07fb67a153880436a35f3a0d79d7b81c7e8b2aa;hpb=ba50de94fa8728459333e95a5019d1cfbf23dd78;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index f07fb67..cd1a220 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -587,6 +587,13 @@ zle -N insert-unicode-char #k# Insert Unicode character bindkey '^Xi' insert-unicode-char +#m# k Shift-tab Perform backwards menu completion +if [[ -n "$terminfo[kcbt]" ]]; then + bindkey "$terminfo[kcbt]" reverse-menu-complete +elif [[ -n "$terminfo[cbt]" ]]; then # required for GNU screen + bindkey "$terminfo[cbt]" reverse-menu-complete +fi + ## toggle the ,. abbreviation feature on/off # NOABBREVIATION: default abbreviation-state # 0 - enabled (default) @@ -912,8 +919,19 @@ zle -N insert-last-typed-word; #k# Insert last typed word bindkey "\em" insert-last-typed-word -#k# Shortcut for \kbd{fg} -bindkey -s '^z' "fg\n" +function grml-zsh-fg() { + if (( ${#jobstates} )); then + zle .push-input + [[ -o hist_ignore_space ]] && BUFFER=' ' || BUFFER='' + BUFFER="${BUFFER}fg" + zle .accept-line + else + zle -M 'No background jobs. Doing nothing.' + fi +} +zle -N grml-zsh-fg +#k# A smart shortcut for \kbd{fg} +bindkey '^z' grml-zsh-fg # run command line as user root via sudo: sudo-command-line() { @@ -2131,7 +2149,11 @@ if check_com -c screen ; then elif [[ -r $HOME/.screenrc ]] ; then alias screen="${commands[screen]} -c $HOME/.screenrc" else - [[ -r /etc/grml/screenrc_grml ]] && alias screen="${commands[screen]} -c /etc/grml/screenrc_grml" + if [[ -r /etc/grml/screenrc_grml ]]; then + alias screen="${commands[screen]} -c /etc/grml/screenrc_grml" + else + [[ -r /etc/grml/screenrc ]] && alias screen="${commands[screen]} -c /etc/grml/screenrc" + fi fi fi @@ -2958,7 +2980,7 @@ minimal-shell() { emulate -L zsh local shell="/bin/mksh" - if ! check_com -c ${shell}; then + if [[ ! -x ${shell} ]]; then printf '`%s'\'' not available, giving up.\n' ${shell} >&2 return 1 fi @@ -3478,10 +3500,16 @@ regcheck() { pcre_match $2 && echo "regex matches" || echo "regex does not match" } -#f5# List files which have been modified within the last {\it n} days +#f5# List files which have been changed within the last {\it n} days, {\it n} defaults to 1 +changed() { + emulate -L zsh + print -l *(c-${1:1}) +} + +#f5# List files which have been modified within the last {\it n} days, {\it n} defaults to 1 new() { emulate -L zsh - print -l *(m-$1) + print -l *(m-${1:1}) } #f5# Grep in history