summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authornaegi <gouge.tristan@gmail.com>2016-08-15 02:45:00 +0200
committerRobby Russell <robby@planetargon.com>2016-08-14 17:45:00 -0700
commit341e83f6f2b45c80a4c555f1a0f04ff6acbc15b9 (patch)
treeadad4f270193c4dcd8c4090cc5a6a17a29bcd80f /plugins
parent40a9d9cb913d113d0606b121ea0d8d570e84c539 (diff)
downloadzsh-341e83f6f2b45c80a4c555f1a0f04ff6acbc15b9.tar.gz
zsh-341e83f6f2b45c80a4c555f1a0f04ff6acbc15b9.tar.bz2
zsh-341e83f6f2b45c80a4c555f1a0f04ff6acbc15b9.zip
Plugin : Sudo - Add support of sudoedit (#5035)
* Add sudoedit support * change describtion of sudo plugin
Diffstat (limited to 'plugins')
-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