In order to open PDFs using an external application, one can use the following script:
augroup nonvim
au!
au BufRead *.pdf sil exe "!open " . shellescape(expand("<afile>")) | bd
augroup end
However, this is not optimal, because the pdf would still be loaded into vim, which will take a while if it is large. More importantly, your window layout will be messed up if you have more than one window showing, because of bd
.
So, I thought of using BufReadPre
instead of using BufRead
. This way, I may still be able to cancel reading the file into a buffer. The question is: how?