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

I have this is vifmrc:

filextype <text/plain> sensible-editor %f

This makes Enter default to open any plain text file in my sensible-editor.

Now, suppose the plain text file is a Python program. In that case, I would like :file to list python3 %f as an alternative so that I can easily execute it. I tried adding

filextype *.py python3 %f

That works, but python3 takes the place of sensible-editor as the default action, and that is irrespective of the statement being before or after the <text/plain> statement.

Is there any way to make the alternative command the 2nd option? Thank you!

1 Answer

0 votes
by

Mime-type of Python files seems to be text/x-python, hence <text/plain> doesn't match it.

by

Very true, Xaizek, that solves the problem, thanks. However, there are other cases where the mime-type is still text/plain but it would be useful to register a new program in the :file dialog for a particular "extension", for example, Gnuplot for .dat files.

by

In those cases the order will make difference. It didn't in this case because sets of files matched by two commands were disjoint.

...