From c0fb8fba2c2a20cb4505ac9da1a3e1e6a889869d Mon Sep 17 00:00:00 2001 From: wodesuck Date: Fri, 11 Jan 2013 20:20:10 +0800 Subject: [PATCH] Add sudo plugin which bind \e\e to add sudo in front of the command --- plugins/sudo/sudo.plugin.zsh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 plugins/sudo/sudo.plugin.zsh diff --git a/plugins/sudo/sudo.plugin.zsh b/plugins/sudo/sudo.plugin.zsh new file mode 100644 index 000000000..31d54a29c --- /dev/null +++ b/plugins/sudo/sudo.plugin.zsh @@ -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