0

Many non alpha-numeric characters appear as jumbled mess when using less and man. Currently, I'm using zsh but the same problem happens in bash and sh. The problem also appears in both the st and termite terminal emulators.

man grep produces:

Broken man page

How can i fix this?

env -i TERM=$TERM PATH=/usr/bin:/bin HOME=/none man grep renders correctly.

jeohd
  • 103

2 Answers2

1

Since the problem disappears with a minimal environment, it's caused by an environment variable. It turns out to be your LESS_TERMCAP settings. You've set them to sequences beginning with [. They're missing the initial escape character.

csi=$(printf '\033[')
export LESS_TERMCAP_mb="${csi}1;31m"
…
0

These vars were exported in my ~/.profile. Removing them solved the issue.

export LESS=-R
export LESS_TERMCAP_mb="$(printf '%b' '[1;31m')"
export LESS_TERMCAP_md="$(printf '%b' '[1;36m')"
export LESS_TERMCAP_me="$(printf '%b' '[0m')"
export LESS_TERMCAP_so="$(printf '%b' '[01;44;33m')"
export LESS_TERMCAP_se="$(printf '%b' '[0m')"
export LESS_TERMCAP_us="$(printf '%b' '[1;32m')"
export LESS_TERMCAP_ue="$(printf '%b' '[0m')"
jeohd
  • 103