Add sudo plugin which bind \e\e to add sudo in front of the command

This commit is contained in:
wodesuck 2013-01-11 20:20:10 +08:00
commit c0fb8fba2c

View file

@ -0,0 +1,7 @@
sudo-command-line() {
[[ -z "$BUFFER" ]] && zle up-history
[[ "$BUFFER" != "sudo *" ]] && BUFFER="sudo $BUFFER"
zle end-of-line
}
zle -N sudo-command-line
bindkey '\e\e' sudo-command-line