744f3654e2bfb4806381ca4f0a5dfcfa5b1c3b83

Author
dongweiming <ciici123@hotmail.com>
Committer
dongweiming <ciici123@hotmail.com>
Date

Message

Add sudo plugin

Diff

 1diff --git a/plugins/sudo/sudo.zsh b/plugins/sudo/sudo.zsh
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..d12e068530e70ca2dc8e55d21e628214ecadbf29
 4--- /dev/null
 5+++ b/plugins/sudo/sudo.zsh
 6@@ -0,0 +1,22 @@
 7+# ------------------------------------------------------------------------------
 8+# Description
 9+# -----------
10+#
11+# sudo will be inserted before the command
12+#
13+# ------------------------------------------------------------------------------
14+# Authors
15+# -------
16+#
17+# * Dongweiming <ciici123@gmail.com>
18+#
19+# ------------------------------------------------------------------------------
20+
21+sudo-command-line() {
22+[[ -z $BUFFER ]] && zle up-history
23+[[ $BUFFER != sudo\ * ]] && BUFFER="sudo $BUFFER"
24+zle end-of-line 
25+}
26+zle -N sudo-command-line
27+# Defined shortcut keys: [Esc] [Esc]
28+bindkey "\e\e" sudo-command-line