summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorJerry Ling <jerryling315@gmail.com>2015-07-29 20:05:44 +0800
committerJerry Ling <jerryling315@gmail.com>2015-07-29 20:05:44 +0800
commitc83575da3fb103af55215835c9e4add2665fbc86 (patch)
tree3ec0eee2755a7304ef6ad1bc366b6d1c44ca707e /plugins
parenta207a38d634cc10441636bc4359cd8a18c502dea (diff)
downloadzsh-c83575da3fb103af55215835c9e4add2665fbc86.tar.gz
zsh-c83575da3fb103af55215835c9e4add2665fbc86.tar.bz2
zsh-c83575da3fb103af55215835c9e4add2665fbc86.zip
Add 'man' plugin.
Inspired by sudo. But we have man-preview!
Diffstat (limited to 'plugins')
-rw-r--r--plugins/man/man.zsh27
1 files changed, 27 insertions, 0 deletions
diff --git a/plugins/man/man.zsh b/plugins/man/man.zsh
new file mode 100644
index 000000000..3490b0b61
--- /dev/null
+++ b/plugins/man/man.zsh
@@ -0,0 +1,27 @@
+# ------------------------------------------------------------------------------
+# Author
+# ------
+#
+# * Jerry Ling<jerryling315@gmail.com>
+#
+# ------------------------------------------------------------------------------
+# Usgae
+# -----
+#
+# man will be inserted before the command
+#
+# ------------------------------------------------------------------------------
+
+man-command-line() {
+ [[ -z $BUFFER ]] && zle up-history
+ [[ $BUFFER != man\ * ]] && LBUFFER="man $LBUFFER"
+}
+zle -N man-command-line
+# Defined shortcut keys: [Esc]man
+bindkey "\e"man man-command-line
+
+
+# ------------------------------------------------------------------------------
+# Also, you might want to use man-preview included in 'osx' plugin
+# just substitute "man" in the function with "man-preview" after you included OS X in
+# the .zshrc \ No newline at end of file