From c83575da3fb103af55215835c9e4add2665fbc86 Mon Sep 17 00:00:00 2001 From: Jerry Ling Date: Wed, 29 Jul 2015 20:05:44 +0800 Subject: [PATCH] Add 'man' plugin. Inspired by sudo. But we have man-preview! --- plugins/man/man.zsh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 plugins/man/man.zsh 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 +# +# ------------------------------------------------------------------------------ +# 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