Commit ff8d7995 authored by Fabio Strozzi's avatar Fabio Strozzi
Browse files

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.
parent 3ea33841
......@@ -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]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment