1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-12-28 15:21:58 +00:00

Merge pull request #4154 from sfragis/toggle-sudo

Esc-esc toggles sudo
This commit is contained in:
Robby Russell 2015-09-19 08:59:29 -07:00
commit 681c42ac46

View file

@ -14,7 +14,11 @@
sudo-command-line() {
[[ -z $BUFFER ]] && zle up-history
[[ $BUFFER != sudo\ * ]] && LBUFFER="sudo $LBUFFER"
if [[ $BUFFER == sudo\ * ]]; then
LBUFFER="${LBUFFER#sudo }"
else
LBUFFER="sudo $LBUFFER"
fi
}
zle -N sudo-command-line
# Defined shortcut keys: [Esc] [Esc]