fix: simplify sudo plugin

sudoedit isn't available on all systems.
sometimes we don't want to use $EDITOR. or it is not set.
master
George Rawlinson 1 year ago
parent 2688ff59a1
commit 51e5d74b70
Signed by: grawlinson
GPG Key ID: E0959FEA8B550539
  1. 9
      plugins/sudo

@ -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…
Cancel
Save