allow customization of colors for colored-man

This commit is contained in:
Tommy Wang 2015-06-17 14:14:13 -05:00
commit 8941cb67d9

View file

@ -1,32 +1,50 @@
if [ "$OSTYPE[0,7]" = "solaris" ] if [ "$OSTYPE[0,7]" = "solaris" ]
then then
if [ ! -x ${HOME}/bin/nroff ] if [ ! -x ${HOME}/bin/nroff ]
then then
mkdir -p ${HOME}/bin mkdir -p ${HOME}/bin
cat > ${HOME}/bin/nroff <<EOF cat > ${HOME}/bin/nroff <<EOF
#!/bin/sh #!/bin/sh
if [ -n "\$_NROFF_U" -a "\$1,\$2,\$3" = "-u0,-Tlp,-man" ]; then if [ -n "\$_NROFF_U" -a "\$1,\$2,\$3" = "-u0,-Tlp,-man" ]; then
shift shift
exec /usr/bin/nroff -u\${_NROFF_U} "\$@" exec /usr/bin/nroff -u\${_NROFF_U} "\$@"
fi fi
#-- Some other invocation of nroff #-- Some other invocation of nroff
exec /usr/bin/nroff "\$@" exec /usr/bin/nroff "\$@"
EOF EOF
chmod +x ${HOME}/bin/nroff chmod +x ${HOME}/bin/nroff
fi fi
fi fi
zstyle :omz:plugins:colored-man mb $(printf "\e[1;31m")
zstyle :omz:plugins:colored-man md $(printf "\e[1;31m")
zstyle :omz:plugins:colored-man me $(printf "\e[0m")
zstyle :omz:plugins:colored-man se $(printf "\e[0m")
zstyle :omz:plugins:colored-man so $(printf "\e[1;44;33m")
zstyle :omz:plugins:colored-man ue $(printf "\e[0m")
zstyle :omz:plugins:colored-man us $(printf "\e[1;32m")
man() { man() {
env \ local _mb _md _me _se _so _ue _us
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \ zstyle -s :omz:plugins:colored-man mb _mb
LESS_TERMCAP_me=$(printf "\e[0m") \ zstyle -s :omz:plugins:colored-man md _md
LESS_TERMCAP_se=$(printf "\e[0m") \ zstyle -s :omz:plugins:colored-man me _me
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ zstyle -s :omz:plugins:colored-man se _se
LESS_TERMCAP_ue=$(printf "\e[0m") \ zstyle -s :omz:plugins:colored-man so _so
LESS_TERMCAP_us=$(printf "\e[1;32m") \ zstyle -s :omz:plugins:colored-man ue _ue
PAGER=/usr/bin/less \ zstyle -s :omz:plugins:colored-man us _us
_NROFF_U=1 \
PATH=${HOME}/bin:${PATH} \ env \
man "$@" LESS_TERMCAP_mb=$_mb\
LESS_TERMCAP_md=$_md\
LESS_TERMCAP_me=$_me\
LESS_TERMCAP_se=$_se\
LESS_TERMCAP_so=$_so\
LESS_TERMCAP_ue=$_ue\
LESS_TERMCAP_us=$_us\
PAGER=/usr/bin/less \
_NROFF_U=1 \
PATH=${HOME}/bin:${PATH} \
man "$@"
} }