zsh-grawlinson/plugins/sudo

19 lines
368 B
Plaintext
Raw Normal View History

#
2019-10-31 23:18:00 +00:00
# sudo will be inserted before the current command
#
2019-10-31 23:18:00 +00:00
sudo-command-line() {
[[ -z $BUFFER ]] && zle up-history
if [[ $BUFFER == sudo\ * ]]; then
LBUFFER="${LBUFFER#sudo }"
else
LBUFFER="sudo $LBUFFER"
fi
}
zle -N sudo-command-line
# defined shortcut keys: [Esc] [Esc]
bindkey "\e\e" sudo-command-line
# vim: ft=zsh expandtab tabstop=2 shiftwidth=2