浏览代码

Add 'man' plugin.

Inspired by sudo. But we have man-preview!
Jerry Ling 8 年之前
父节点
当前提交
c83575da3f
共有 1 个文件被更改,包括 27 次插入0 次删除
  1. 27 0
      plugins/man/man.zsh

+ 27 - 0
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