Welcome to Vifm Q&A, where you can ask questions about Vifm usage. Registration is optional, anonymous posts are moderated. GitHub or Google logins are enabled.
0 votes
in vifm by
edited by

I have this configuration in my Windows vifmrc file. Trying to launch pdf files. When I hit Enter, it opens the editor instead of sumatraPDF. It does work when I enter ":file" and select the application.

filetype *.pdf "C:\Program Files\SumatraPDF\SumatraPDF.exe" %f
fileviewer *.pdf "C:\Program Files\SumatraPDF\SumatraPDF.exe" %f

Anyone know what I'm doing wrong? Thanks.



I have same issue vifm 0.10.1 with pdf and Foxit:
filextype *.pdf "C:\Program Files (x86)\Foxit Software\Foxit Reader\FoxitReader.exe" %"c:p

It works from the :file menu, but don't work with Enter (open the file with my gvim)




is there [present] mark in front of the command in :file menu?


OK, it looks like detection doesn't work with backslashes. Use

filextype *.pdf "C:/Program Files (x86)/Foxit Software/Foxit Reader/FoxitReader.exe" %"c:p

I'll look into why is that.


Thanks for your quick response.
Indeed forward slash solve the issue! the [present] appeared and the feature work.

For me, it's good enough. Maybe you can just update the help file, something along:

On Windows path to executables containing spaces can (and should be
for correct work with such paths) be double quoted, also should use
forward slashes e.g. "C:/Program Files (x86)/..."


Made proper fix, so both slashes will work in release following 0.10.1.

1 Answer

0 votes
selected by
Best answer

:fileviewer isn't for opening files, so you can drop that line.

It might be that you have another :filetype definition earlier in your vifmrc file. Does SumartraPDF appear on the first line of the :file menu? If not, reorder :filetype commands to have SumatraPDF above the rest.

Also, you probably want to use %"f instead of %f, because on Windows the first one works better with spaces and special characters.

Update (2020-06-14): backslashes are the reason, replace them with forward slashes:

filextype *.pdf  "C:/Program Files/SumatraPDF/SumatraPDF.exe" %"f

This looks like a bug, need to check why it doesn't normalize slashes in this case. So thanks for the report.

Update (2020-07-04): fixed the bug.


I removed the fileviewer line and now only have:

filetype *.pdf "C:\Program Files\SumatraPDF\SumatraPDF.exe" %"f

Still launching the editor. When I use ":file", the menu shows:

┌── Filetype associated commands ───────────────────────
│ "C:\Program Files\SumatraPDF\SumatraPDF.exe" %"f

and when I hit Enter, it does launch the pdf viewer. Anyways, thanks. I do
appreciate the response.


Okay, I got it working by using putting the portable version of sumatraPDF.exe somewhere in the Path variables. I assume this would work with the regular full version as well.

filetype *.pdf SumatraPDF %"f

So looks like maybe I got the syntax wrong or vifm on Windows is not liking the absolute path used in the configuration.


I think it should work, maybe there is a bug or I'm missing something. 0.10.1 prints [present] for recognized commands, so something is wrong with checking command existence if you're on 0.10.1.

If you would like to make a bug report or feature request consider using GitHub, SourceForge or e-mail. Posting such things here is acceptable, but this is not a perfect place for them.

Support Ukraine