From 744f3654e2bfb4806381ca4f0a5dfcfa5b1c3b83 Mon Sep 17 00:00:00 2001 From: dongweiming Date: Thu, 4 Jul 2013 19:18:52 +0800 Subject: [PATCH] Add sudo plugin --- plugins/sudo/sudo.zsh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 plugins/sudo/sudo.zsh diff --git a/plugins/sudo/sudo.zsh b/plugins/sudo/sudo.zsh new file mode 100644 index 000000000..d12e06853 --- /dev/null +++ b/plugins/sudo/sudo.zsh @@ -0,0 +1,22 @@ +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# sudo will be inserted before the command +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Dongweiming +# +# ------------------------------------------------------------------------------ + +sudo-command-line() { +[[ -z $BUFFER ]] && zle up-history +[[ $BUFFER != sudo\ * ]] && BUFFER="sudo $BUFFER" +zle end-of-line +} +zle -N sudo-command-line +# Defined shortcut keys: [Esc] [Esc] +bindkey "\e\e" sudo-command-line