Using vim as a pager (in gentoo)

Wondering what the “vim-pager” use flag on app-editors/vim did, I gave it a shot. Turns out it gives you 2 extra commands: vimpager and vimmanpager. So adding

export MANPAGER=/usr/bin/vimmanpager

to your login script of choice (.bashrc works just fine), man will use vim as a pager, complete with systax highlighting and ability to use the mouse scroll wheel and other such fun things to navigate man pages.

You could also set PAGER (and/or alias less) to vimpager, but I found that vimpager waits for EOF before displaying anything, meaning it won’t work for commands that run until interupted, and commands that run for a long time wait until completion to show anything at all.

UPDATE to ask: If anyone knows a way to use this but to use the colors from a program with color output, eg. “ls –color=always | vimpager”, please let me know.


2 Comments

  1. Posted February 1, 2007 at 7:11 pm | Permalink

    I normally wouldn’t comment on something of this nature, but this is one of the coolest things I’ve seen in a long time. Much more interesting than most of the crap you read in blogs (including mine for that matter lol). Nice.

  2. Marc
    Posted February 9, 2009 at 4:34 pm | Permalink

    There’s also Most… This is a very good pager, with color support.

One Trackback

  1. By Less Colors For Man Pages « Helpful Linux Tidbits on January 22, 2010 at 2:47 pm

    [...] 23, 2009 at 7:32 am (Linux) Man pages by default use less for displaying. I’ve used vim before to for colored text in man pages but something got bjorked in an update. You can color man pages [...]

Post a Comment

Your email is never shared. Required fields are marked *

*
*