Sunday, September 20, 2009

View PDF contents in Vim

From http://vim.wikia.com/wiki/Open_PDF_files

To open a PDF file (in readonly mode) add the following lines to your .vimrc

autocmd BufReadPre *.pdf set ro nowrap
autocmd BufReadPost *.pdf silent %!pdftotext "%" -nopgbrk -layout -q
-eol unix -

(remove any line breaks, the second autocmd entry is one continuous line
all the way to the "unix -" statement)