Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to view man pages in color in Fish

📅 2015-Jul-20 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

[caption id="attachment_7126" align="aligncenter" width="496"][Man pages in color](https://codeyarns.files.wordpress.com/2015/07/20150720_man_color.png) Man pages in color[/caption]

When you open a man page you are confronted with a wall of white-on-black text. You may have noticed that man pages have some formatting information. This can be used to render the formatted elements in various colors. This can make reading and searching for information in a man page a pleasant affair.

To render man pages with colors in the Fish shell, add these lines to ~/.config/fish/config.fish:

set -x LESS_TERMCAP_mb (printf "33[01;31m")  
set -x LESS_TERMCAP_md (printf "33[01;31m")  
set -x LESS_TERMCAP_me (printf "33[0m")  
set -x LESS_TERMCAP_se (printf "33[0m")  
set -x LESS_TERMCAP_so (printf "33[01;44;33m")  
set -x LESS_TERMCAP_ue (printf "33[0m")  
set -x LESS_TERMCAP_us (printf "33[01;32m")

Tried with: Fish 2.2b1 and Ubuntu 14.04