colored-man.plugin.zsh 763 B

1234567891011121314151617181920212223242526272829303132
  1. if [ "$OSTYPE[0,7]" = "solaris" ]
  2. then
  3. if [ ! -x ${HOME}/bin/nroff ]
  4. then
  5. mkdir -p ${HOME}/bin
  6. cat > ${HOME}/bin/nroff <<EOF
  7. #!/bin/sh
  8. if [ -n "\$_NROFF_U" -a "\$1,\$2,\$3" = "-u0,-Tlp,-man" ]; then
  9. shift
  10. exec /usr/bin/nroff -u\${_NROFF_U} "\$@"
  11. fi
  12. #-- Some other invocation of nroff
  13. exec /usr/bin/nroff "\$@"
  14. EOF
  15. chmod +x ${HOME}/bin/nroff
  16. fi
  17. fi
  18. man() {
  19. env \
  20. LESS_TERMCAP_mb=$(printf "\e[1;31m") \
  21. LESS_TERMCAP_md=$(printf "\e[1;31m") \
  22. LESS_TERMCAP_me=$(printf "\e[0m") \
  23. LESS_TERMCAP_se=$(printf "\e[0m") \
  24. LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
  25. LESS_TERMCAP_ue=$(printf "\e[0m") \
  26. LESS_TERMCAP_us=$(printf "\e[1;32m") \
  27. PAGER=/usr/bin/less \
  28. _NROFF_U=1 \
  29. PATH=${HOME}/bin:${PATH} \
  30. man "$@"
  31. }