mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2025-12-06 07:20:40 +01:00
Esc-esc now toggles sudo.
Press esc-esc once to add sudo (normal behaviour), press it twice to remove it from the beginning of the line.
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user