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.
+1 vote
in vifm by

It is possible to open a file with a different program than the one defined in vifmrc?

filextype *.txt vis %f

I want to open .txt files with vis by default, but I need vim occasionally.

1 Answer

+1 vote
by
 
Best answer

Not sure I understand the issue, but:

  • there can be more than one registered program, among which you can choose via :file command, repeat :filetype multiple times or provide other commands separated by commas;
  • :edit is always there to open file in vim (or whatever is configured via 'vicmd');
  • nothing stops you from using :!program %c.
by

Could :!program just assume I want %c whithout having to type it? Ideally, I would like to select a file, press a key, and type the program I want to execute it with.

by

!something is to execute arbitrary command, implicit %c will break this. But for simple cases you can define new :command and bind it to a key:
:command! open :!%a %%c :nnoremap o :open<space>

by

I searched whole of internet to find that :file command :) thank you so much
:file is like "r" key in ranger, I really need it
this :file should be more bold in vifm manual page !!

...