Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
vim as a manpage reader
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
moment
n00b
n00b


Joined: 06 Dec 2007
Posts: 6

PostPosted: Mon May 05, 2008 12:03 pm    Post subject: vim as a manpage reader Reply with quote

reasons: better search, syntax highlighting etc.

How to:
enable USE="vim-pager" for package app-editors/vim and add
Code:
export MANPAGER=vimmanpager

to your .bashrc.

credit: http://hawking.nonlogic.org/archives/2008/04/06/viewing_man_pages_with_vim/
Back to top
View user's profile Send private message
Kingmilo
Apprentice
Apprentice


Joined: 29 Apr 2005
Posts: 173
Location: South Africa

PostPosted: Tue May 06, 2008 5:20 am    Post subject: Reply with quote

EXPORT wont save it for future sessions, you need to change the default in;

Code:
vi /etc/rc.conf


go down to the line that says;

Code:
EDITOR="/bin/nano"


change to;

Code:
EDITOR="/bin/vim"


Then refresh your profile;

Code:
env-update && source /etc/profile

_________________
trample the weak, hurdle the dead.. .
Back to top
View user's profile Send private message
nihilo
Apprentice
Apprentice


Joined: 05 Nov 2002
Posts: 168
Location: berkeley, ca, usa

PostPosted: Tue May 06, 2008 11:36 pm    Post subject: Re: vim as a manpage reader Reply with quote

Thanks for the tip. The man pages that have code in them look much better via vim.
Back to top
View user's profile Send private message
faux
n00b
n00b


Joined: 26 Oct 2007
Posts: 61
Location: Linz, Austria

PostPosted: Sat May 10, 2008 11:49 am    Post subject: Reply with quote

Nice tip! Thank's!

Is there a possibility to setup the pager to allow scrolling line-by-line via the up/down keys?
Back to top
View user's profile Send private message
ppurka
Advocate
Advocate


Joined: 26 Dec 2004
Posts: 3206

PostPosted: Sun May 11, 2008 4:28 am    Post subject: Reply with quote

faux wrote:
Nice tip! Thank's!

Is there a possibility to setup the pager to allow scrolling line-by-line via the up/down keys?
It already does :roll:

moment: An excellent tip! This had made reading man pages much smoother :D
_________________
emerge --quiet redefined | E17 vids: I, II
Back to top
View user's profile Send private message
faux
n00b
n00b


Joined: 26 Oct 2007
Posts: 61
Location: Linz, Austria

PostPosted: Sun May 11, 2008 5:00 am    Post subject: Reply with quote

ppurka wrote:
faux wrote:
Nice tip! Thank's!

Is there a possibility to setup the pager to allow scrolling line-by-line via the up/down keys?
It already does :roll:


Yes, but you have to move the cursor over the screen before scrolling backwards, after scrolling forwards.
Back to top
View user's profile Send private message
moment
n00b
n00b


Joined: 06 Dec 2007
Posts: 6

PostPosted: Sun May 11, 2008 10:11 am    Post subject: Reply with quote

glad you all liked it :D vim is great!
Back to top
View user's profile Send private message
ppurka
Advocate
Advocate


Joined: 26 Dec 2004
Posts: 3206

PostPosted: Sun May 11, 2008 3:58 pm    Post subject: Reply with quote

faux wrote:
ppurka wrote:
faux wrote:
Nice tip! Thank's!

Is there a possibility to setup the pager to allow scrolling line-by-line via the up/down keys?
It already does :roll:


Yes, but you have to move the cursor over the screen before scrolling backwards, after scrolling forwards.
You can try the following. Make your own script, call it for example myvimmanpager and set your MANPAGER variable to this script. Next, add the second-last line to the original script /usr/bin/vimmanpager, to make it read like this (myvimmanpager):
Code:
#!/bin/sh
sed -e 's/\x1B\[[[:digit:]]\+m//g' | \
tr '\267' '.' | col -b | \
      vim \
         -c 'let no_plugin_maps = 1' \
         -c 'set nolist nomod ft=man' \
         -c 'let g:showmarks_enable=0' \
            -c 'map <up> <C-Y>' \
         -c 'runtime! macros/less.vim' -
There could be a way of doing this in vimrc, but apparently the filetype is not being set when vimrc is run so I am unable to selectively run the map command on only man files.
_________________
emerge --quiet redefined | E17 vids: I, II
Back to top
View user's profile Send private message
faux
n00b
n00b


Joined: 26 Oct 2007
Posts: 61
Location: Linz, Austria

PostPosted: Sun May 11, 2008 5:14 pm    Post subject: Reply with quote

Thank's for the trick! Exactly what I want! :)
Back to top
View user's profile Send private message
Massimo B.
Veteran
Veteran


Joined: 09 Feb 2005
Posts: 1210
Location: PB, Germany

PostPosted: Wed Mar 28, 2012 11:43 am    Post subject: Reply with quote

faux wrote:
ppurka wrote:
faux wrote:

Is there a possibility to setup the pager to allow scrolling line-by-line via the up/down keys?
It already does :roll:

Yes, but you have to move the cursor over the screen before scrolling backwards, after scrolling forwards.

That is vim's behaviour by default. Even in vim you can always use C-e and C-y to scroll the screen. Make your remapping if you like other key strokes.
_________________
ppc:PowerBook5,8 15"(1440)-G4/1.67,2G | amd64:Acer Z5610 (Core2QuadQ8200),i5-3470 | amd64-prefix:OpenSuse | Lila-Theme
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