add vim conf files
[arrow.git] / conf_slk120 / vim / _vim / plugin / pdftotext.vim
blobb0c6a9c8a1b84c06c9052b6b69eab0b25c1445c1
1 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2 " Name:             pdftotext
3 " Description:  Use the pdftotext program to filter .pdf files into plain text
4 " Author:           Marc Prud'hommeaux <mwp1@cornell.edu>
5 " Last Change:  18 May, 2004
7 " Licence:          This program is free software; you can redistribute it
8 "               and/or modify it under the terms of the GNU General Public
9 "               License. See http://www.gnu.org/copyleft/gpl.txt
10 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
12 " run pdftotext to read PDF files
13 autocmd BufReadPost,FileReadPost *.pdf call s:readpdf()
14     
15 fun s:readpdf()
16     if (!executable("pdftotext"))
17         echo "Error: pdftotext not installed or not in path"
18         return
19     endif
21     let tmp = tempname()
22     " invoke: pdftotext sourcefile.pdf tempfile
23     call system ("pdftotext '" . escape (expand("<afile>"), "'") . "' " . tmp)
24     setlocal nobin
25         execute "silent '[-1r " . tmp
26     " clean up the temporary file
27     call delete(tmp)
29     " make the buffer unwritable: we don't want to clobber the PDF file!
30     set nowrite
31 endfun