ZSHFiles/custom/prependsudo.zsh

12 lines
327 B
Bash

# https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/sudo/sudo.plugin.zsh
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
bindkey '\e\e' sudo-command-line