Could be a number of problems.
Seeing as you're using zsh
, try putting this in your ~/.zshrc
:
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;47;34m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'
export LESS=-r
Then open a new terminal window and try running
man ls
if it's not working, run each of the following to find out where the problem is:
Number 1
typeset -p LESS_TERMCAP_md | cat -v
should print
typeset -x LESS_TERMCAP_md="^[[01;31m"
and
typeset -p LESS
should print
typeset -x LESS="-r"
if not, you put the export LESS
stuff in the wrong file.
Number 2
echo "${LESS_TERMCAP_md}red${LESS_TERMCAP_me}"
should print
red
in a red color. If it doesn't there is something wrong with your terminal settings. Check your terminal settings (e.g. ~/.Xresources
) or try running gnome-terminal
or xterm
and see if that works.
Number 3
echo -E "a^Ha" | LESS= less -r
(^H
must be entered by pressing Ctrl+V then Ctrl+H)
should print
a
in red. If it doesn't, please run these
type less
less --version
and paste the output back in your question.
Number 4
bzcat /usr/share/man/man1/ls.1.bz2 | \
/bin/sh /usr/bin/nroff -mandoc -Tutf8 | head -n 5 | cat -v
should print
LS(1) User Commands LS(1)
N^HNA^HAM^HME^HE
(note the ^H
like in step number 3)
if it's printing something like:
LS(1) User Commands LS(1)
^[[1mNAME^[[0m
instead, you will need to find a way to disable "sgr escape sequences". The easiest thing to try is adding export GROFF_NO_SGR=1
to .zshrc
, but there are other ways of fixing this.
Number 5
bzcat /usr/share/man/man1/ls.1.bz2 | \
/bin/sh /usr/bin/nroff -mandoc -Tutf8 | less
should display the ls
man page with colors.
man ls
should now be working!
echo $TERM
display?