X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=718853f3925b940d30f73369436bc8e117e065cf;hb=6a2a0dc02cfbbb8615276b95513e8d22f42b2cf8;hp=e21c77227bc9622f5ff2aa3d37040a30c76f3d40;hpb=e01bb8fd4f1afa24ac37638aee2ba1e68959ae2b;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index e21c772..718853f 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -172,6 +172,11 @@ EOF # check for version/system # check for versions (compatibility reasons) +function is51 () { + [[ $ZSH_VERSION == 5.<1->* ]] && return 0 + return 1 +} + function is4 () { [[ $ZSH_VERSION == <4->* ]] && return 0 return 1 @@ -1195,10 +1200,15 @@ zle -N grml-zsh-fg # run command line as user root via sudo: function sudo-command-line () { [[ -z $BUFFER ]] && zle up-history - if [[ $BUFFER != sudo\ * ]]; then - BUFFER="sudo $BUFFER" - CURSOR=$(( CURSOR+5 )) + local cmd="sudo " + if [[ ${BUFFER} == ${cmd}* ]]; then + CURSOR=$(( CURSOR-${#cmd} )) + BUFFER="${BUFFER#$cmd}" + else + BUFFER="${cmd}${BUFFER}" + CURSOR=$(( CURSOR+${#cmd} )) fi + zle reset-prompt } zle -N sudo-command-line @@ -1645,7 +1655,13 @@ zrcautoload zed # else # print 'Notice: no url-quote-magic available :(' # fi -alias url-quote='autoload -U url-quote-magic ; zle -N self-insert url-quote-magic' +if is51 ; then + # url-quote doesn't work without bracketed-paste-magic since Zsh 5.1 + alias url-quote='autoload -U bracketed-paste-magic url-quote-magic; + zle -N bracketed-paste bracketed-paste-magic; zle -N self-insert url-quote-magic' +else + alias url-quote='autoload -U url-quote-magic ; zle -N self-insert url-quote-magic' +fi #m# k ESC-h Call \kbd{run-help} for the 1st word on the command line alias run-help >&/dev/null && unalias run-help @@ -3569,6 +3585,11 @@ function simple-extract () { USES_STDIN=true USES_STDOUT=false ;; + *tar.lrz) + DECOMP_CMD="lrzuntar" + USES_STDIN=false + USES_STDOUT=false + ;; *tar) DECOMP_CMD="tar -xvf -" USES_STDIN=true @@ -3619,6 +3640,11 @@ function simple-extract () { USES_STDIN=true USES_STDOUT=true ;; + *lrz) + DECOMP_CMD="lrunzip -" + USES_STDIN=true + USES_STDOUT=true + ;; *) print "ERROR: '$ARCHIVE' has unrecognized archive type." >&2 RC=$((RC+1))