summaryrefslogtreecommitdiff
path: root/plugins/sudo/sudo.plugin.zsh
diff options
context:
space:
mode:
authorlumbric <lumbric@gmail.com>2013-12-21 19:49:44 +0100
committerlumbric <lumbric@gmail.com>2013-12-21 19:49:44 +0100
commitb58b996b40f8de1f030d59336e3594b63ef598ee (patch)
treee06e1d5d2e2544c83adb3fe2424a221706446699 /plugins/sudo/sudo.plugin.zsh
parenta38af27991d15d14ac4ca55c919bb694d7eafb7a (diff)
downloadzsh-b58b996b40f8de1f030d59336e3594b63ef598ee.tar.gz
zsh-b58b996b40f8de1f030d59336e3594b63ef598ee.tar.bz2
zsh-b58b996b40f8de1f030d59336e3594b63ef598ee.zip
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).
Diffstat (limited to 'plugins/sudo/sudo.plugin.zsh')
-rw-r--r--plugins/sudo/sudo.plugin.zsh22
1 files changed, 22 insertions, 0 deletions
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 <ciici123@gmail.com>
+#
+# ------------------------------------------------------------------------------
+
+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