Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Documentation, Tips & Tricks
  • Search

vim as a manpage reader

Unofficial documentation for various parts of Gentoo Linux. Note: This is not a support forum.
Post Reply
Advanced search
10 posts • Page 1 of 1
Author
Message
moment
n00b
n00b
Posts: 6
Joined: Thu Dec 06, 2007 8:36 pm

vim as a manpage reader

  • Quote

Post by moment » Mon May 05, 2008 12:03 pm

reasons: better search, syntax highlighting etc.

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

Code: Select all

export MANPAGER=vimmanpager
to your .bashrc.

credit: http://hawking.nonlogic.org/archives/20 ... _with_vim/
Top
Kingmilo
Apprentice
Apprentice
User avatar
Posts: 173
Joined: Fri Apr 29, 2005 5:35 am
Location: South Africa

  • Quote

Post by Kingmilo » Tue May 06, 2008 5:20 am

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

Code: Select all

vi /etc/rc.conf
go down to the line that says;

Code: Select all

EDITOR="/bin/nano"
change to;

Code: Select all

EDITOR="/bin/vim"
Then refresh your profile;

Code: Select all

env-update && source /etc/profile
trample the weak, hurdle the dead.. .
Top
nihilo
Apprentice
Apprentice
User avatar
Posts: 168
Joined: Tue Nov 05, 2002 7:06 am
Location: berkeley, ca, usa
Contact:
Contact nihilo
Website

Re: vim as a manpage reader

  • Quote

Post by nihilo » Tue May 06, 2008 11:36 pm

Thanks for the tip. The man pages that have code in them look much better via vim.
Top
faux
n00b
n00b
Posts: 61
Joined: Fri Oct 26, 2007 9:32 am
Location: Linz, Austria
Contact:
Contact faux
Website

  • Quote

Post by faux » Sat May 10, 2008 11:49 am

Nice tip! Thank's!

Is there a possibility to setup the pager to allow scrolling line-by-line via the up/down keys?
Top
ppurka
Advocate
Advocate
Posts: 3257
Joined: Sun Dec 26, 2004 5:05 pm

  • Quote

Post by ppurka » Sun May 11, 2008 4:28 am

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 | Now using kde5 | e is unstable :-/
Top
faux
n00b
n00b
Posts: 61
Joined: Fri Oct 26, 2007 9:32 am
Location: Linz, Austria
Contact:
Contact faux
Website

  • Quote

Post by faux » Sun May 11, 2008 5:00 am

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.
Top
moment
n00b
n00b
Posts: 6
Joined: Thu Dec 06, 2007 8:36 pm

  • Quote

Post by moment » Sun May 11, 2008 10:11 am

glad you all liked it :D vim is great!
Top
ppurka
Advocate
Advocate
Posts: 3257
Joined: Sun Dec 26, 2004 5:05 pm

  • Quote

Post by ppurka » Sun May 11, 2008 3:58 pm

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: Select all

#!/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 | Now using kde5 | e is unstable :-/
Top
faux
n00b
n00b
Posts: 61
Joined: Fri Oct 26, 2007 9:32 am
Location: Linz, Austria
Contact:
Contact faux
Website

  • Quote

Post by faux » Sun May 11, 2008 5:14 pm

Thank's for the trick! Exactly what I want! :)
Top
Massimo B.
Veteran
Veteran
User avatar
Posts: 1940
Joined: Wed Feb 09, 2005 3:05 pm
Location: PB, Germany

  • Quote

Post by Massimo B. » Wed Mar 28, 2012 11:43 am

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.
HP ZBook Power G9 i7-12700H,64GB DDR5|HP ProDesk 600 G5 i7-9700,128GB DDR4
Top
Post Reply

10 posts • Page 1 of 1

Return to “Documentation, Tips & Tricks”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic