openSUSE Forums > Programming/Scripting » Color Man Pages?

Go Back   openSUSE Forums > Programming/Scripting
Forums FAQ Members List Search Today's Posts Mark Forums Read

Programming/Scripting Questions about programming, bash scripts, perl, php, cron jobs, ruby, python, etc.

Reply
Page 1 of 2 1 2
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 21-May-2009, 18:40
Explorer Penguin
 
Join Date: Oct 2008
Posts: 142
LewsTherinTelemon hasn't been rated much yet
Send a message via AIM to LewsTherinTelemon
Post Color Man Pages?

I'm likely over complicating this, but how do you enable color in man pages? I've tried exporting the below values in .bashrc and also setting my pager to most - neither seems to work.

.bashrc contains

Less Colors for Man Pages
export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking
export LESS_TERMCAP_md=$'\E[01;38;5;74m' # begin bold
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;38;5;146m' # begin underline

I also tried adding the following form colored manpages - nion's blog

alias man="TERMINFO=~/.terminfo/ LESS=C TERM=mostlike PAGER=less man"

(Compiled mostlike and used the above)

I also compiled most and exported PAGER=most

Nothing really seems to work.

Am I missing something obvious here?

Cheers,
Pete
Reply With Quote
  #2 (permalink)  
Old 21-May-2009, 18:44
Explorer Penguin
 
Join Date: Oct 2008
Posts: 142
LewsTherinTelemon hasn't been rated much yet
Send a message via AIM to LewsTherinTelemon
Default Re: Color Man Pages?

ah **** - the last solution (compiling and installing most and export PAGER=most in .bashrc works now, resourcing didn't work, just need to reopen terminal.)

You can download the most pager from here: MOST Pager Download Page

However, I really wonder why the first solution (exporting the various termcap settings) does not work. Any one know why?

Pete
Reply With Quote
  #3 (permalink)  
Old 21-May-2009, 19:08
Explorer Penguin
 
Join Date: Oct 2008
Posts: 142
LewsTherinTelemon hasn't been rated much yet
Send a message via AIM to LewsTherinTelemon
Default Re: Color Man Pages - more on less

Oddly, I found that one must install termcap for the export LESS_TERMCAP_md=$'\E[01;38;5;74m' # begin bold and such statements to have a chance or working.

Wow, weird

However, despite having termcap installed, exporting LESS_TERMCAP values still don't work. Very odd.

paracelsus@Callandor:~> less --version
less 424
Copyright (C) 1984-2008 Mark Nudelman

Still rather weird - it works so easily on CentOS.
Reply With Quote
  #4 (permalink)  
Old 22-May-2009, 11:26
cjcox's Avatar
Parent Penguin
 
Join Date: Jun 2008
Location: Frisco, TX
Posts: 762
cjcox hasn't been rated much yet
Default Re: Color Man Pages?

On Fri, 2009-05-22 at 00:16 +0000, LewsTherinTelemon wrote:
> Oddly, I found that one must install termcap for the export
> LESS_TERMCAP_md=$'\E[01;38;5;74m' # begin bold and such statements to
> have a chance or working.
>
> Wow, weird
>
> However, despite having termcap installed, exporting LESS_TERMCAP
> values still don't work. Very odd.
>
> paracelsus@Callandor:~> less --version
> less 424
> Copyright (C) 1984-2008 Mark Nudelman
>
> Still rather weird - it works so easily on CentOS.
>
>


I just tried these:

export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking
export LESS_TERMCAP_md=$'\E[01;31m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # end mode
export LESS_TERMCAP_se=$'\E[0m' # end standout-mode
export LESS_TERMCAP_so=$'\E[01;44;33m' # begin standout-mode - info box
export LESS_TERMCAP_ue=$'\E[0m' # end underline
export LESS_TERMCAP_us=$'\E[01;32m' # begin underline

works fine for me.

Reply With Quote
  #5 (permalink)  
Old 22-May-2009, 17:23
Explorer Penguin
 
Join Date: Oct 2008
Posts: 142
LewsTherinTelemon hasn't been rated much yet
Send a message via AIM to LewsTherinTelemon
Post Re: Color Man Pages?

Would you mind telling me what you have in your .bashrc and and /etc/profile exactly and the following displays?

paracelsus@Callandor:~> env | grep -i term
LESS_TERMCAP_mb=
LESS_TERMCAP_md=
LESS_TERMCAP_me=
TERM=xterm
LESS_TERMCAP_ue=
LESS_TERMCAP_us=
LESS_TERMCAP_so=
LESS_TERMCAP_se=
COLORTERM=1

Strange as it should work but does not seem to for me. Must have something off in /etc/profile I am thinking.

Cheers,
Pete
Reply With Quote
  #6 (permalink)  
Old 22-May-2009, 17:37
Explorer Penguin
 
Join Date: Oct 2008
Posts: 142
LewsTherinTelemon hasn't been rated much yet
Send a message via AIM to LewsTherinTelemon
Default Re: Color Man Pages?

I should have stated that the env variables are displayed as below (as they just call the color escape sequences)

paracelsus@Callandor:~> env | grep -i term
LESS_TERMCAP_mb=
LESS_TERMCAP_md= (displays in red)
LESS_TERMCAP_me= (displays in blue)
TERM=xterm
LESS_TERMCAP_ue=
LESS_TERMCAP_us=
LESS_TERMCAP_so= (displays in grey)
LESS_TERMCAP_se=
COLORTERM=1

They show up okay for me when I show them with env | grep -i term but they don't actually work in displaying the man pages with less as the pager, etc.

Cheers,
Pete
Reply With Quote
  #7 (permalink)  
Old 22-May-2009, 20:23
Flux Capacitor Penguin
 
Join Date: Jun 2008
Location: GMT+10
Posts: 5,109
ken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud of
Default Re: Color Man Pages?

Looking at the man page for less, I don't see any documentation that suggests that these kinds of environment variables are accepted by the standard less on openSUSE. Maybe they work in a modified or cutting edge version of less.
Reply With Quote
  #8 (permalink)  
Old 22-May-2009, 23:59
cjcox's Avatar
Parent Penguin
 
Join Date: Jun 2008
Location: Frisco, TX
Posts: 762
cjcox hasn't been rated much yet
Default Re: Color Man Pages?

On Fri, 2009-05-22 at 22:26 +0000, LewsTherinTelemon wrote:
> Would you mind telling me what you have in your .bashrc and and
> /etc/profile exactly and the following displays?
>
> paracelsus@Callandor:~> env | grep -i term
> LESS_TERMCAP_mb=
> LESS_TERMCAP_md=
> LESS_TERMCAP_me=
> TERM=xterm
> LESS_TERMCAP_ue=
> LESS_TERMCAP_us=
> LESS_TERMCAP_so=
> LESS_TERMCAP_se=
> COLORTERM=1
>
> Strange as it should work but does not seem to for me. Must have
> something off in /etc/profile I am thinking.


Did you just cut and paste the lines from my message directly into your
shell? No need to try to put into your profile when just testing.


Reply With Quote
  #9 (permalink)  
Old 23-May-2009, 00:00
cjcox's Avatar
Parent Penguin
 
Join Date: Jun 2008
Location: Frisco, TX
Posts: 762
cjcox hasn't been rated much yet
Default Re: Color Man Pages?

On Sat, 2009-05-23 at 01:26 +0000, ken yap wrote:
> Looking at the man page for less, I don't see any documentation that
> suggests that these kinds of environment variables are accepted by the
> standard less on openSUSE. Maybe they work in a modified or cutting edge
> version of less.


It's there, been there for many, many years. It's just not documented.


Reply With Quote
  #10 (permalink)  
Old 23-May-2009, 00:12
Explorer Penguin
 
Join Date: Oct 2008
Posts: 142
LewsTherinTelemon hasn't been rated much yet
Send a message via AIM to LewsTherinTelemon
Post Re: Color Man Pages?

Hey cjcox,

I did not just paste the lines into bash - I have them in my .bashrc, and if I examine them, I see they are being defined and exported correctly, for example:

paracelsus@Callandor:~> env | grep -i term
LESS_TERMCAP_mb=
LESS_TERMCAP_md= (displays in red)
LESS_TERMCAP_me= (displays in blue)
TERM=xterm
LESS_TERMCAP_ue=
LESS_TERMCAP_us=
LESS_TERMCAP_so= (displays in grey)
LESS_TERMCAP_se=
COLORTERM=1

That is what is so odd about this. There they are, displayed in color, everything looks great. echo $PAGER shows less is set, and termcap is installed - but man pager are still not in color. (I did comment out unset termcap in /etc/profile - made no difference.)

Would you mind sharing your complete /etc/profile, .bashrc and what versions of termap and less you are using?

Thanks!
Pete
Reply With Quote
Reply
Page 1 of 2 1 2

Bookmarks


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2