I have a path name with page number in vim buffer and I want to open it using Sumatra PDF.

d:\drivers\instruction.pdf -page 40

Instruction above works fine using command line - cmd.exe and it opens file properly at the page 40. When I open it with gx command from GVim, file is opened, but page is not correct. (It is last opened page) How to open PDF file so it will go to proper page?

My conf: Windows 10. GVim 8.1, SumatraPDF

1 Answer 1


You have to create your own mapping. Perhaps like this:

nnoremap gX :!SumatraPdf <C-r><C-l><CR>

The <C-r><C-l> copies the current line as parameters for SumatraPDF.

Important: The line must only contain the parameters for SumatraPDF.

See :h c_CTRL-R_CTRL-L

Your Answer

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

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