From b58b996b40f8de1f030d59336e3594b63ef598ee Mon Sep 17 00:00:00 2001 From: lumbric Date: Sat, 21 Dec 2013 19:49:44 +0100 Subject: fix name schema for sudo plugin Plugin won't load automatically if added to variable $plugins, if name schema different than $name/$name.plugin.zsh is used (see is_plugin() in oh-my-zsh.sh). --- plugins/sudo/sudo.plugin.zsh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 plugins/sudo/sudo.plugin.zsh (limited to '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..d12e06853 --- /dev/null +++ b/plugins/sudo/sudo.plugin.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 -- cgit v1.2.3-70-g09d2