fix: simplify sudo plugin
sudoedit isn't available on all systems. sometimes we don't want to use $EDITOR. or it is not set.
This commit is contained in:
parent
2688ff59a1
commit
51e5d74b70
1 changed files with 3 additions and 6 deletions
|
@ -1,14 +1,11 @@
|
||||||
|
#
|
||||||
# sudo will be inserted before the current command
|
# sudo will be inserted before the current command
|
||||||
|
#
|
||||||
|
|
||||||
sudo-command-line() {
|
sudo-command-line() {
|
||||||
[[ -z $BUFFER ]] && zle up-history
|
[[ -z $BUFFER ]] && zle up-history
|
||||||
if [[ $BUFFER == sudo\ * ]]; then
|
if [[ $BUFFER == sudo\ * ]]; then
|
||||||
LBUFFER="${LBUFFER#sudo }"
|
LBUFFER="${LBUFFER#sudo }"
|
||||||
elif [[ $BUFFER == $EDITOR\ * ]]; then
|
|
||||||
LBUFFER="${LBUFFER#$EDITOR }"
|
|
||||||
LBUFFER="sudoedit $LBUFFER"
|
|
||||||
elif [[ $BUFFER == sudoedit\ * ]]; then
|
|
||||||
LBUFFER="${LBUFFER#sudoedit }"
|
|
||||||
LBUFFER="$EDITOR $LBUFFER"
|
|
||||||
else
|
else
|
||||||
LBUFFER="sudo $LBUFFER"
|
LBUFFER="sudo $LBUFFER"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue