Plugin : Sudo - Add support of sudoedit (#5035)

* Add sudoedit support

* change describtion of sudo plugin
This commit is contained in:
naegi 2016-08-15 02:45:00 +02:00 committed by Robby Russell
parent 40a9d9cb91
commit 341e83f6f2

View File

@ -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