Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: Color Man Pages?

  1. #1
    LewsTherinTelemon is offline Busy Penguin
    Join Date
    Oct 2008
    Posts
    498

    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

  2. #2
    LewsTherinTelemon is offline Busy Penguin
    Join Date
    Oct 2008
    Posts
    498

    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

  3. #3
    LewsTherinTelemon is offline Busy Penguin
    Join Date
    Oct 2008
    Posts
    498

    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.

  4. #4
    cjcox's Avatar
    cjcox is offline Wise Penguin
    Join Date
    Jun 2008
    Location
    Frisco, TX
    Posts
    1,152

    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.


  5. #5
    LewsTherinTelemon is offline Busy Penguin
    Join Date
    Oct 2008
    Posts
    498

    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

  6. #6
    LewsTherinTelemon is offline Busy Penguin
    Join Date
    Oct 2008
    Posts
    498

    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

  7. #7
    ken_yap is offline Flux Capacitor Penguin
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,955
    Blog Entries
    4

    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.

  8. #8
    cjcox's Avatar
    cjcox is offline Wise Penguin
    Join Date
    Jun 2008
    Location
    Frisco, TX
    Posts
    1,152

    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.



  9. #9
    cjcox's Avatar
    cjcox is offline Wise Penguin
    Join Date
    Jun 2008
    Location
    Frisco, TX
    Posts
    1,152

    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.



  10. #10
    LewsTherinTelemon is offline Busy Penguin
    Join Date
    Oct 2008
    Posts
    498

    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

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search Engine Friendly URLs by vBSEO 3.5.2 PL2