Welcome to Vifm Q&A, where you can ask questions about using Vifm. Registration is optional, anonymous posts are moderated. E-mail and GitHub logins are enabled.
0 votes
in vifm by

For an OpenSSH public key, Vifm reports this with ctrl+g:

Name:        machine.pub
Size:        563   B
Type:        OpenSSH RSA public key
Mime Type:   application/vnd.ms-publisher

I'd like to define a fileviewer for files with type "OpenSSH RSA public key".

Using the incorrect MIME type for the fileviewer seems brittle: fileviewer <application/vnd.ms-publisher> ssh-keygen -l -f %c

1 Answer

+1 vote
by
selected by
 
Best answer

Do you get this result on Linux? Type always comes from the file program, but Mime Type may also come from Glib and looks like it's the one who gets it wrong.

There is no way to match by that type string and Glib is used if Vifm is compiled with its support. You can match by both file name and MIME type to reduce false positive results:

fileviewer {*.pub}<application/vnd.ms-publisher> ssh-keygen -l -f %c

Maybe there should be an option to specify priority of MIME type sources instead of hard-coding Glib to be the first one.

by

Yes, this is on Arch Linux. Being able to use the result of file for vifm's fileviewer would be great since it seems more accurate than Glib. As another example, a private SSH key without a file ending is "text/plain" according to Glib and "OpenSSH private key" according to file.


vifm --version gives:

Version: 0.14.3
Git info: built out of repository
Compiled at: Aug 28 2025 07:07:18

Support of extended keys is on
Parsing of .desktop files is enabled
With GLib2 library
With magic library
Without X11 library
Without dynamic loading of X11 library
With file program
With -n option for cp and mv
With remote command execution
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.
...