man.zsh 822 B

123456789101112131415161718192021222324252627
  1. # ------------------------------------------------------------------------------
  2. # Author
  3. # ------
  4. #
  5. # * Jerry Ling<jerryling315@gmail.com>
  6. #
  7. # ------------------------------------------------------------------------------
  8. # Usgae
  9. # -----
  10. #
  11. # man will be inserted before the command
  12. #
  13. # ------------------------------------------------------------------------------
  14. man-command-line() {
  15. [[ -z $BUFFER ]] && zle up-history
  16. [[ $BUFFER != man\ * ]] && LBUFFER="man $LBUFFER"
  17. }
  18. zle -N man-command-line
  19. # Defined shortcut keys: [Esc]man
  20. bindkey "\e"man man-command-line
  21. # ------------------------------------------------------------------------------
  22. # Also, you might want to use man-preview included in 'osx' plugin
  23. # just substitute "man" in the function with "man-preview" after you included OS X in
  24. # the .zshrc