Skip to content

Colored man pages with less and TERMCAP #10087

Closed Answered by faho
volodymyrprokopyuk asked this question in Q&A
Discussion options

You must be logged in to vote

You want the \e to appear outside of quotes.

https://fishshell.com/docs/current/fish_for_bash_users.html#quoting:

There is no $'', instead the sequences that would transform are transformed when unquoted:

That means:

set -gx LESS -RF
set -gx LESS_TERMCAP_mb \e'[01;31m'
set -gx LESS_TERMCAP_md \e'[01;38;5;74m'
set -gx LESS_TERMCAP_me \e'[0m'
set -gx LESS_TERMCAP_se \e'[0m'
set -gx LESS_TERMCAP_so \e'[38;5;246m'
set -gx LESS_TERMCAP_ue \e'[0m'
set -gx LESS_TERMCAP_us \e'[04;38;5;146m'

Alternatively, use set_color:

set -gx LESS -RF
set -gx LESS_TERMCAP_mb (set_color --bold red)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by volodymyrprokopyuk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants