Color Coded Man Pages With Vim |
|
March 23, 2008 |
Want a color coded man page viewer with hyperlink support? Well look no further. This simple script is a wrapper around the built in :Man function in Vim. Basically it allows Vim to be started up in man mode and adds some key shortcuts like the default man page viewer.
Before we begin, we need to make sure the filetype plugin for man is enabled in Vim. To do this we need to source from our .vimrc file.
I have the following line in mine:
You location may vary depending on versions/distributions etc. Once we have enabled the plugin, you can view man pages in Vim using the :Man command. We can now also use the below command in place of our standard man pager. Place this command inside a shell script, put it on your path and/or set up an alias to it like follows: For the full script see vimman.sh at
When viewing man pages in Vim, other referenced commands are highlighted (in blue usually). By placing the cursor on the command name and pressing
source
vim -R -c “:set foldmethod=indent” -c “:set foldnestmax=2″ -c “:set foldenable” -c “:Man $1″ -c “:normal ” -c “:q” -c “:set nomodifiable” -c “:map q :qalias
Ctrl-] you will jump to the man page of that command. Ctrl-o will jump back to the original page.



March 23, 2008
Leave a Reply