From 341e83f6f2b45c80a4c555f1a0f04ff6acbc15b9 Mon Sep 17 00:00:00 2001 From: naegi Date: Mon, 15 Aug 2016 02:45:00 +0200 Subject: [PATCH] Plugin : Sudo - Add support of sudoedit (#5035) * Add sudoedit support * change describtion of sudo plugin --- plugins/sudo/sudo.plugin.zsh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/sudo/sudo.plugin.zsh b/plugins/sudo/sudo.plugin.zsh index 0ba8bed5..0b843822 100644 --- a/plugins/sudo/sudo.plugin.zsh +++ b/plugins/sudo/sudo.plugin.zsh @@ -2,7 +2,7 @@ # Description # ----------- # -# sudo will be inserted before the command +# sudo or sudoedit will be inserted before the command # # ------------------------------------------------------------------------------ # Authors @@ -16,6 +16,12 @@ sudo-command-line() { [[ -z $BUFFER ]] && zle up-history if [[ $BUFFER == sudo\ * ]]; then LBUFFER="${LBUFFER#sudo }" + elif [[ $BUFFER == $EDITOR\ * ]]; then + LBUFFER="${LBUFFER#$EDITOR }" + LBUFFER="sudoedit $LBUFFER" + elif [[ $BUFFER == sudoedit\ * ]]; then + LBUFFER="${LBUFFER#sudoedit }" + LBUFFER="$EDITOR $LBUFFER" else LBUFFER="sudo $LBUFFER" fi