summaryrefslogtreecommitdiff
path: root/plugins/sudo/sudo.plugin.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/sudo/sudo.plugin.zsh')
-rw-r--r--plugins/sudo/sudo.plugin.zsh8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/sudo/sudo.plugin.zsh b/plugins/sudo/sudo.plugin.zsh
index 0ba8bed5b..0b843822e 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