Vim: Automatically opening POD as a PDF

Ovid on 2009-11-15T13:03:47

Doing a bit of POD munging and using Pod::Parser::Groffmom with this. The following is OS X specific, but it should be easy to adjust for another system. It automatically opens any POD file as a PDF document with cover page and table of contents:

au! FileType pod           :call PodMappings()

function! PodMappings()
    noremap  ,r :call PodToPDF()
endfunction

function! PodToPDF()
    let filename   = bufname("%")
    let postscript = filename . ".ps"
    let command  = 'perl $(which pod2mom) --cover --toc --ps '
        \ . filename
        \ . ' && open ' . postscript
    echo system(command)
endfunction


how do you like it?

markjugg on 2009-11-17T15:25:11

Interesting idea. How do you like using it in practice?

Re:how do you like it?

Ovid on 2009-11-17T16:53:20

I've liked it quite a bit. I have a custom subclass of Pod::Parser::Groffmom which even writes out slides for me, so I can create a presentation by writing POD. I then just run a version of the above (pod2mom takes a --parser option if you want a subclass) and get a lovely PDF and my S5 slides at the same time.