c83575da3fb103af55215835c9e4add2665fbc86

Author
Jerry Ling <jerryling315@gmail.com>
Committer
Jerry Ling <jerryling315@gmail.com>
Date

Message

Add 'man' plugin.

Inspired by sudo. But we have man-preview!

Diff

 1diff --git a/plugins/man/man.zsh b/plugins/man/man.zsh
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..3490b0b61b85ed7c0d6363728f7d4014fb85920d
 4--- /dev/null
 5+++ b/plugins/man/man.zsh
 6@@ -0,0 +1,27 @@
 7+# ------------------------------------------------------------------------------
 8+# Author
 9+# ------
10+#
11+# * Jerry Ling<jerryling315@gmail.com>
12+#
13+# ------------------------------------------------------------------------------
14+# Usgae
15+# -----
16+#
17+# man will be inserted before the command
18+#
19+# ------------------------------------------------------------------------------
20+
21+man-command-line() {
22+    [[ -z $BUFFER ]] && zle up-history
23+    [[ $BUFFER != man\ * ]] && LBUFFER="man $LBUFFER"
24+}
25+zle -N man-command-line
26+# Defined shortcut keys: [Esc]man
27+bindkey "\e"man man-command-line
28+
29+
30+# ------------------------------------------------------------------------------
31+# Also, you might want to use man-preview included in 'osx' plugin
32+# just substitute "man" in the function with "man-preview" after you included OS X in
33+# the .zshrc