mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-19 21:41:07 +01:00
Add 'man' plugin.
Inspired by sudo. But we have man-preview!
This commit is contained in:
parent
a207a38d63
commit
c83575da3f
1 changed files with 27 additions and 0 deletions
27
plugins/man/man.zsh
Normal file
27
plugins/man/man.zsh
Normal file
|
@ -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
|
Loading…
Reference in a new issue