Suppose I want to filter foo.doc through antiword or bar.pdf
through pdftk.  (Both of these are tricks that I have learned only
recently.)  It seems simple enough.  For example, vim tip #790,
http://www.vim.org/tips/tip.php?tip_id=790
suggests

autocmd BufReadPost *.doc silent %!/usr/bin/antiword '%'

(along with an autocmd or two to set 'ro' and--I am not sure
why--'nohlsearch'.  I tried this, and it worked pretty well until I
tried it on (ugh) file\ with\ spaces.doc .  So now I have

autocmd BufReadPost,FileReadPost *.doc execute '%!antiword' escape(@%, ' ')

     IIUC, all the details like error handling and escaping spaces in
file names are already handled by autoload/gzip.vim .  Before settling
on the above, I tried

" autocmd BufReadPost,FileReadPost *.doc call gzip#read("antiword")

but, as you can see, I commented it out because it did not work.  I
apologize:  I have not tried as hard as I might to get it to work.  Does
anyone else know how to do this?  Or does autoload/gzip.vim need to be
made more flexible before it can be applied to other filters (antiword,
pdftk for example) as well as gzip?

                                        --Benji Fisher

Reply via email to