Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to view man pages in color in Fish

📅 2015-Jul-20 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ colors, fish, man ⬩ 📚 Archive

Man pages in color

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


© 2023 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧