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.

Allow files to be opened only for the current tab

0 votes
asked Mar 24 in vifm by dmlemos

Hi.

I am wondering if there is a way to open mpv only on the current tab. When programs run, vifm is hidden until the program finishes. This makes it impossible to see tabs or switch between them.

My reasoning is to keep one sticky tab for music directory browsing, while still using other tabs for other things. I suspect this could be useful for other things, as ex: file transcoding.
Switching to background playing is not an option.

This is my filetype config:

filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus,*.webm,*.aac
                \ {Play with mpv}
                \ clear && mpv %f

Would this be a job better suited for a terminal multiplexer or am I missing something here? If so, is there a plugin to do this with tmux?

1 Answer

+1 vote
answered Mar 24 by xaizek

Hello.

vifm doesn't have builtin terminals, so you can't have multiple consoles within it.

You're right that terminal multiplexers are a good fit for this job. There is some basic builtin support, which is enabled via :screen command. It's called "screen", but works with tmux as well (active terminal multiplexer is detected automatically). After activation, applications started by vifm will be placed in separate tabs.

commented Jun 8 by dmlemos

I have been using tmux integration for a while, but find it difficult to manage. Looking at the documentation I couldn't find how to configure opening in panes instead of windows.

Alternatively how could it open a new window, but next to the current one?
Because I always have multiple windows, the window opened by vifm gets lost at the end.

Lastly, I cannot revert screen mode. How can I reset to the default? Perhaps I miss understood the options but running :screen!& does not work.

commented Jun 8 by xaizek

There is %s macro to open commands in splits, but there is no way to make this a default for opening in a terminal multiplexer.

:screen toggles its state, so just do :screen again.

commented Jun 13 by dmlemos

Thanks for the reply.

Would you mind giving me an example for the macro? Not familiar with them yet.

The state toggle makes sense. Stupid of me :->

commented Jun 13 by xaizek

Simply mention %s somewhere in the external command, e.g., append it:

filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus,*.webm,*.aac
                \ {Play with mpv}
                \ clear && mpv %f %s
commented Jun 14 by dmlemos

Great! Works good enough for me.

Cheers :)

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.
...