X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=a992e3f5c7bc72f6897b0c9a7ab9db95db3d53a9;hb=95639b9a60e468cf56d37a7234a91160f51fb1fc;hp=5a74feedf7413ac4c4c6cea54237370b74c645ce;hpb=4db20203215091835dbf4aab193a620800f1f25c;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 5a74fee..a992e3f 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -432,10 +432,6 @@ is4 && setopt share_history # save each command's beginning timestamp and the duration to the history file setopt extended_history -# If a new command line being added to the history list duplicates an older -# one, the older command is removed from the list -is4 && setopt histignorealldups - # remove command lines from the history list when the first character on the # line is a space setopt histignorespace @@ -905,14 +901,7 @@ function grmlcomp () { fi local localname - if check_com hostname ; then - localname=$(hostname) - elif check_com hostnamectl ; then - localname=$(hostnamectl --static) - else - localname="$(uname -n)" - fi - + localname="$(uname -n)" hosts=( "${localname}" "$_ssh_config_hosts[@]" @@ -1200,10 +1189,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