Perldoc for Vim, Now in Color!

Vim being one of the most commonly used programming editors by the nerds that perl programmers are, it has quite a few scripts allowing you to read module documentation straight from within Vim itself. All of them, however, just grab the output of the 'perldoc' command and place it in a plain text buffer. PERLDOC2 does a similar job, but with a twist - it adds syntax coloring to make reading documentation easier and more convenient. Check out these screenshots:

Headings and verbatim text

Lists

Currently supported is highlighting of headers, lists and verbatim text. Inline formatting is not implemented yet.

To install, you need to get the Pod::Simple::Vim module from CPAN first, and then install PERLDOC2 as you would any other vim script. In your vimrc file, you will need to setup the g:Perldoc_path variable, pointing to a directory where the generated documentation files will be stored , trailing slash included (keeping a cache allows you to easily navigate back and forth between the doc files you have recently viewed). Then just type :Perldoc Module::Name in vim's command prompt.

How it works

Pod::Simple::Vim is a Pod::Simple-based parser that outputs the requested documentation in plain text but with some special formatting codes. These formatting codes are in fact quite similar to the ones used to display vim's own help format. PERLDOC2 provides a syntax file, perldoc.vim, which interprets those formatting codes. Vim talks to Pod::Simple::Vim via the pod2vim script installed by Pod::Simple::Vim.

And last but not least, I have just set up my first repository on github, and this is my first upload there - contributions are welcome!

Posted in Modules
blog comments powered by Disqus