views:

1054

answers:

2

How can you get similar highlightings to Zsh's Less than Bash's Less in Ubuntu?

I switched from OS X to Ubuntu. My Less do not work as expected in Zsh.

Manuals in my Less are green and black with or without the following code.

     # comment these out in Ubuntu
     export LESS_TERMCAP_mb=$'\E[01;31m'         # begin blinking
     export LESS_TERMCAP_me=$'\E[0m'        # end mode

     export LESS_TERMCAP_se=$'\E[0m'        # end standout-mode
     export LESS_TERMCAP_so=$'\E[38;5;246m' # begin standout-mode - info box
     export LESS_TERMCAP_ue=$'\E[0m'        # end underline

     export LESS_TERMCAP_us=$'\E[04;33;146m'    # begin underline is now yellow
     #                             |  |  |
     #                             |  |----------------- yellow
     #                             |-------------------- underline

     # to have the indication of cursor's location and line numbers, and R
     export LESS="-mNR"
     #               |--------- only ASCII color

The code makes manuals readable in OS X, but it does not work for Ubuntu in Zsh.

Ubuntu has excellent highlightings in Bash's Less. My manuals have the colors yellow, green and black in Bash without my code. Both Zsh and Bash use the same Less at /usr/bin/less. This suggests me that Ubuntu's Bash has some dot-files which configure it somewhere.

Where are highlightings for Ubuntu's Less in Bash?

+1  A: 

My default shell is bash so take this with a grain of salt. Start with /etc/profile and see how it sources bash-specific files. You need to re-create that logic for zsh. Maybe the zsh-lovers package can help, at least its title of tips, tricks and examples for the zsh is suggestive.

Dirk Eddelbuettel
+3  A: 

This works for me in zsh on archlinux.

0x89
Thank you for your answer!
Masi
Thanks for the question - I did not know about this, but I always secretly wanted it..
0x89