Cody Blog

Using vim as a man-page viewer under Linux

If you use bash, just add the following script in your ~/.bashrc:

export PAGER="/bin/sh -c \"unset PAGER;col -b -x | \
    vim -R -c 'set ft=man nomod nolist' -c 'map q :q<CR>' \
    -c 'map <SPACE> <C-D>' -c 'map b <C-U>' \
    -c 'nmap K :Man <C-R>=expand(\\\"<cword>\\\")<CR><CR>' -\""

Compare with the original Main

Main

Main in VIM has good looking with syntaxheight.

Man in VIM

Reference: