Vim as MANPAGER

January 19, 2013

linux

I like Vim, so I try to use it at many places. Like in my shell (set -o vi), and when writing and coding.

After some Googling I found that Vim can also be used as a MANPAGER. But there is one nagging issue. To quit viewing the manual page you have to type ‘:q’, which is one keystroke more then when using less as your MANPAGER… Needless to say: this is unacceptable.

Save this script in a file named manpager:

col -b | view -c 'set ft=man nomod nolist' \
-c 'map q <ESC>:quit!<CR>' -

Make it executable and then:

export MANPAGER=/home/miekg/bin/manpager
Vim