diff --git a/plugins/sudo/sudo.plugin.zsh b/plugins/sudo/sudo.plugin.zsh index e3ba39918..0ba8bed5b 100644 --- a/plugins/sudo/sudo.plugin.zsh +++ b/plugins/sudo/sudo.plugin.zsh @@ -14,7 +14,11 @@ sudo-command-line() { [[ -z $BUFFER ]] && zle up-history - [[ $BUFFER != sudo\ * ]] && LBUFFER="sudo $LBUFFER" + if [[ $BUFFER == sudo\ * ]]; then + LBUFFER="${LBUFFER#sudo }" + else + LBUFFER="sudo $LBUFFER" + fi } zle -N sudo-command-line # Defined shortcut keys: [Esc] [Esc]