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

at the bottom of all fileviewers I would like to create a catchall fileviewer (maybe two?) that execute a program if the file under cursor has readable text, and another program if it doesn't have readable text (like .iso, .exe, .py ecc); would that be feasible?

1 Answer

0 votes
by
selected by
 
Best answer

You could use mimetypes for that, but they won't always give an expected result. For example, you list .py-files as unreadable, but their mimetype is text/x-script.python.

" non-directory with a mimetype starting with "text/"
fileviewer {*[^/]}<text/*> text-file-handler

" non-directory with a mimetype not starting with "text/"
fileviewer {*[^/]}!<text/*> non-text-file-handler
by

yeah mimetype is prone to miss, thank you for the insight tho, I think I'll going to use extension instead to be more precise

...