2

I am currently using gvim in an MS-Windows environment.

As part of a vim script function, I need to open a pdf file. So I call system like so:

call system(l:pdf_file)

This opens and displays the pdf_file. Yet, the problem is, that the script hangs until I close the pdf viewer application. I'd rather have the script to continue with its execution.

So, I tried changing the function call to, in order to open and display my pdf file asynchronously:

call system('start ' . l:pdf_file)

Now, I get an E371: Command not found error.

I am not sure why this is and more importantly, how I can achieve what I want.

1 Answer 1

5

Not sure why this happens. What works is to use :call system('start /b '.l:pdf_file) I guess you want the '/b' parameter anyhow, since this will prevent popping up a cmd windows. Also you probably want to use :sil! to prevent an error message, because vim tries to read back the result of this call. Perhaps it is easier to use :! start /b foobar.pdf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.