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-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
|
||||
|
|
Loading…
Reference in a new issue