diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index 0e056dc72..fd8fdb63d 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -91,3 +91,13 @@ bindkey "^[m" copy-prev-shell-word ## Fix weird sequence that rxvt produces #bindkey -s '^[[Z' '\t' # + +# [ESC ESC] - insert sudo in the Begining of line +sudo-command-line() { + [[ -z $BUFFER ]] && zle up-history + [[ $BUFFER != sudo\ * ]] && BUFFER="sudo $BUFFER" + zle end-of-line +} +zle -N sudo-command-line +bindkey "\e\e" sudo-command-line +