It turns out that Vim ships with a pretty sweet
man page plugin included, which you’d discover if you edited
man pages very often, but most of us don’t so it’s probably a lot more useful to us as a viewer.
Some of you Vim wise guys are saying, “But Vim already has a handy
man page viewer, just press
K in normal mode for the word under the cursor.” Sure. If you type ‘sh’ a lot in your code and docs maybe that’s great. I can count the number of times I’ve actually used it on one hand (except with plugins that remap it to language-specific doc lookups). Plus it just loads the page in a crummy pager.
Run that in command mode and observe that you now have a
:Man command available. Think up some fun
man page to browse and BOOM, you’re reading it in a split window just like
:Man sh — that. Yeah, whoa.
This, my friends, is a bonafide Vim buffer. It’s pretty. It’s got syntax highlighting. But best of all, references to other
man pages are tags. So when you’re reading that
bash page and you’re like, “WTF
isatty(3)?” you just put your cursor over that reference and with
Ctrl-] you reach enlightenment. When you see it’s
libc and you tremble,
Ctrl-t and you’re back to
"This is swell!" you say. "It’d be cool if
K used this for those five times in my life.”
nmap K :Man <cword><CR>
Put that in your
.vimrc and smoke it. Don’t forget to first
runtime the plugin as above while you’re in there, to make it persistent.
Some folks like this so much they want to use it when they invoke
man on the command line. I’m not drinking that kool aid yet but you might dig it.
 Or not. What a buzzkill. If you’re on a Mac or perhaps other platform and get an error, there’s this bug where a well-intentioned fellow fixed a problem but introduced a new one for others. Do `:e $VIMRUNTIME/ftplugin/man.vim` and comment out the `let $MANPAGER =”“` line about 20 lines in, and you should be sitting pretty.
 The plugin actually maps `<Leader>K` for you to do the same thing, if you want to just commit that to memory instead.