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.
+2 votes
in vifm by

Consider a command "foo" and a file name "bar".

In midnight commander one can:

  1. type the command followed by a space
  2. hit Ctrl-Enter to get the name of the currently selected file added to the command line
  3. it is possible to repeat 2. multiple times for many files
  4. after this the command line looks like "$ foo bar"
  5. hit enter to execute it
  6. hit Ctrl-O to hide mc panes and see the output
  7. hit Ctrl-O again to show panes back

How to do the same (or a similar) workflow in vifm?

2 Answers

+1 vote
edited by
Best answer

As far as I know mc doesn't provide real prompt, just similar one. And seventh step might need a correction, any key seems to restore normal mc UI.

A way of doing this in vifm is:

  1. Typing :!!anything (note double exclamation mark to force waiting after running the command, with :!anything shell is paused only if command fails).
  2. Using one of Ctrl-X shortcuts (Ctrl-X c adds current file name, see other keys in documentation).
  3. Repeat previous step inserting parts of file names in different places of the command.
  4. Hit Enter.
  5. View command output and hit Enter to dismiss it.

As for the Ctrl-O-like shortcut, it's easy to add, although this particular key is already taken by history movement. There is an old TODO item related to this:

Maybe we should add a command to view screen ?

So it was considered, but there were no actual requests for it to be added and adding something unused isn't the best strategy. Let me know if you need such a shortcut.

Update: :hide command was added in v0.10.1.

+1 vote
edited by

And, adding to Xaizek's answer, this actually gets better if you want to repeat step 2 for multiple files: Just select the files (with t or visual mode) and then use the %f macro:

:!!foo %f

I agree that a quick view to the shell would be helpful

There is :hide command since v0.10.1.


I didn't notice that addition, it's great! Thanks, much better than using an Xterm specific feature.