Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Colorize manpage on Gentoo
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
sipingal
n00b
n00b


Joined: 12 May 2008
Posts: 62
Location: China

PostPosted: Tue Mar 24, 2009 4:53 am    Post subject: Colorize manpage on Gentoo Reply with quote

There is little difference on Gentoo Linux. I am introducing two solutions to implement it.

Solution I

======
Using sys-apps/man & sys-apps/most
1. Install sys-apps/most
Code:
# emerge -v sys-apps/most


2. Modify /etc/man.conf
Code:
NROFF           /usr/bin/nroff -mandoc

to
Code:
NROFF           /usr/bin/nroff -c -mandoc


3. Copy a rcfile of the most
Code:
$ bzcat /usr/share/doc/most-5.0.0a/lesskeys.rc.bz2 > ~/.mostrc


4. Place PAGER environment variable to user's profile(such as ~/.bashrc or ~/.profile etc.)
Code:
# export PAGER=most


Solution II
======
Using sys-apps/man-db & sys-apps/less
1. Install sys-apps/man-db
Code:
# emerge -Cv sys-apps/man
# emerge -v sys-apps/man-db
# emerge -v sys-apps/less


2. Modify /etc/man_db.conf
Code:
#DEFINE  nroff   nroff -mandoc

to
Code:
DEFINE  nroff   nroff -c -mandoc


3. Place the less related environment variables to user's profile
Code:
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'


Verify the effects
Now we can test the screen of a manpage:
Code:
$ man man


Last edited by sipingal on Wed Mar 25, 2009 1:10 am; edited 1 time in total
Back to top
View user's profile Send private message
ppurka
Advocate
Advocate


Joined: 26 Dec 2004
Posts: 3182

PostPosted: Tue Mar 24, 2009 5:34 am    Post subject: Reply with quote

Solution III
Use vimmanpager :P
http://forums.gentoo.org/viewtopic-t-691090-highlight-vimmanpager.html
_________________
emerge --quiet redefined | E17 vids: I, II
Back to top
View user's profile Send private message
sipingal
n00b
n00b


Joined: 12 May 2008
Posts: 62
Location: China

PostPosted: Tue Mar 24, 2009 7:46 am    Post subject: Reply with quote

ppurka wrote:
Solution III
Use vimmanpager :P
http://forums.gentoo.org/viewtopic-t-691090-highlight-vimmanpager.html


Thank you very much.

The vimpager is very cool. I compared the vimmanpager with most/less. The vimpager is more colorful & beautiful. But it seems the vimpager loses many colors. Any body knows how to fix it? :(

I used following comand to compared the output:
Quote:
man 2 open
Back to top
View user's profile Send private message
ppurka
Advocate
Advocate


Joined: 26 Dec 2004
Posts: 3182

PostPosted: Tue Mar 24, 2009 3:11 pm    Post subject: Reply with quote

You will probably need to use a vim color theme. Many are available at the vim website, or here:
http://www.cs.cmu.edu/~maverick/VimColorSchemeTest/
_________________
emerge --quiet redefined | E17 vids: I, II
Back to top
View user's profile Send private message
timeBandit
Bodhisattva
Bodhisattva


Joined: 31 Dec 2004
Posts: 2671
Location: here, there or in transit

PostPosted: Tue Mar 24, 2009 3:35 pm    Post subject: Reply with quote

Moved from Other Things Gentoo to Documentation, Tips & Tricks.

(Maybe this time I'll finally implement this on my systems. :P)
_________________
Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others.
Back to top
View user's profile Send private message
djinnZ
Advocate
Advocate


Joined: 02 Nov 2006
Posts: 4688
Location: not so far from an evil, world famous volcano. Under dictatorship, idiocracy, property of banks...

PostPosted: Tue Mar 24, 2009 7:41 pm    Post subject: Reply with quote

remember than the builld of some packages will sure fail with MANPAGER/PAGER set to vimmanpager or most. I not remember exacly what are but the simple solution is to override it for emerge to the default.
_________________
scita et risus abundant in ore stultorum sed etiam semper severi insani sunt:wink:
mala tempora currunt...mater stultorum semper pregna est :evil:
Murpy'sLaw:If anything can go wrong, it will - O'Toole's Corollary:Murphy was an optimist :wink:
Back to top
View user's profile Send private message
Enlight
Advocate
Advocate


Joined: 28 Oct 2004
Posts: 3514
Location: Alsace (France)

PostPosted: Tue Mar 24, 2009 8:07 pm    Post subject: Reply with quote

M^woman (whithout man) has the same effect in emacs.
_________________
le "lol" est aux boulets ce que le ";" est au programmeurs
Back to top
View user's profile Send private message
ppurka
Advocate
Advocate


Joined: 26 Dec 2004
Posts: 3182

PostPosted: Tue Mar 24, 2009 8:18 pm    Post subject: Reply with quote

djinnZ wrote:
remember than the builld of some packages will sure fail with MANPAGER/PAGER set to vimmanpager or most. I not remember exacly what are but the simple solution is to override it for emerge to the default.
Never faced this problem till date.
_________________
emerge --quiet redefined | E17 vids: I, II
Back to top
View user's profile Send private message
Nerevar
l33t
l33t


Joined: 31 May 2008
Posts: 710

PostPosted: Wed Mar 25, 2009 12:06 am    Post subject: Reply with quote

Solution II works for me w/o installing man-db. Just modify /etc/man.conf instead of /etc/man-db.conf.
Note: It's important that you remove /var/cache/man after making the change to /etc/man.conf. Otherwise you'll still be using the cached version of the manpage which was processed w/o the -c option.
Back to top
View user's profile Send private message
sipingal
n00b
n00b


Joined: 12 May 2008
Posts: 62
Location: China

PostPosted: Wed Mar 25, 2009 1:13 am    Post subject: Sorry! I made a mistake:( Reply with quote

Nerevar wrote:
Solution II works for me w/o installing man-db. Just modify /etc/man.conf instead of /etc/man-db.conf.
Note: It's important that you remove /var/cache/man after making the change to /etc/man.conf. Otherwise you'll still be using the cached version of the manpage which was processed w/o the -c option.



/etc/man-db.conf should be /etc/man_db.conf. :(
Back to top
View user's profile Send private message
swimmer
Veteran
Veteran


Joined: 15 Jul 2002
Posts: 1287
Location: Netherlands

PostPosted: Wed Mar 25, 2009 8:38 am    Post subject: Reply with quote

vimpager ++
Back to top
View user's profile Send private message
djinnZ
Advocate
Advocate


Joined: 02 Nov 2006
Posts: 4688
Location: not so far from an evil, world famous volcano. Under dictatorship, idiocracy, property of banks...

PostPosted: Wed Mar 25, 2009 11:57 am    Post subject: Reply with quote

ppurka wrote:
djinnZ wrote:
remember than the builld of some packages will sure fail with MANPAGER/PAGER set to vimmanpager or most. I not remember exacly what are but the simple solution is to override it for emerge to the default.
Never faced this problem till date.
This is an example. Adding a MANPAGER=/usr/bin/less to /etc/make.conf or running
Code:
MANPAGER=/usr/bin/less emerge somethingbroken
is the simple fix.
Nothing wrong (i use vimpager) but better advise for possible issues. The affected packages are not often updated (i think gpm and some old base libraries of X have the same troubles) so is reasonable than you have never faced it. Note than the build will hang with MANPAGER=most also (in fact with everything different from less).
The two cents of mine about this tip. :wink:
_________________
scita et risus abundant in ore stultorum sed etiam semper severi insani sunt:wink:
mala tempora currunt...mater stultorum semper pregna est :evil:
Murpy'sLaw:If anything can go wrong, it will - O'Toole's Corollary:Murphy was an optimist :wink:
Back to top
View user's profile Send private message
UnoSD
Apprentice
Apprentice


Joined: 27 Jun 2011
Posts: 247

PostPosted: Thu Mar 22, 2012 11:14 am    Post subject: Reply with quote

Nerevar wrote:
Solution II works for me w/o installing man-db. Just modify /etc/man.conf instead of /etc/man-db.conf.
Note: It's important that you remove /var/cache/man after making the change to /etc/man.conf. Otherwise you'll still be using the cached version of the manpage which was processed w/o the -c option.


It worked for me, too; but some manual don't. Trying "man man" or "man mplayer" works great, but "man most" and "man less" shows me some flat monochrome pages... It seems to be kind of coloured because the "command line" below is with colors, but not the pages... Any idea of how to solve this?

P.s. Have i, perhaps, to emerge man-db? Does it matter?
Back to top
View user's profile Send private message
linoseros
n00b
n00b


Joined: 05 Feb 2012
Posts: 3

PostPosted: Fri Mar 23, 2012 10:34 am    Post subject: Reply with quote

very cool
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum