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

as title, how can I achieve that? I need two version of this solution: one that expand subfolder's content too (if present) and one that does not do that. I then need to add single files to that custom view too.
I've tried using %f and %u in the vifm command line but I can't get that to work (it gives me no range is allowed).

1 Answer

0 votes
by
selected by
 
Best answer

I need two version of this solution: one that expand subfolder's content too (if present)

Try:

:!find %u

and one that does not do that.

Try:

:!find -maxdepth 1 %u

I then need to add single files to that custom view too.

Can't add files to a custom view after its creation, but if meant combining directories and files, then:

:!find dir1 dir2 file1 file3 %u
by

than you! I'll try those out asap.
but if I would multiselect with vifm itself? without using find, just selecting multiple folders under the same path, what command should I use to open them?

by

If you want to recurse use !find %f %u, otherwise !printf '%%s\n' %f %u.

by
edited by

perfect, those works flawlessly:

:!find %f -type f %u
:!find %f -maxdepth 1 -type f %u

now, when I have the curson on a directory and press the enter key it opens that directory, how I could bind ctrl-enter or shift-enter to those custom find command?

edit: it would be better if I could bind one of those two commands that would fire with the only enter key when multiple folders are selected, but I don't know if that is possible

edit2: In the end I've implemented the %f variable in my fzf script (that previously was searching by default in the working directory): vifm it's truly a masterpiece of software <3

by

You can't bind Ctrl+Enter or Shift+Enter, Vifm should get the same key code as when you press Enter for both of them.

You can have different behaviour depending on selection like this (condition is hacky, need to add a function for selection size):

nnoremap <cr> : if expand('%c') == expand('%f')
             \|     let $CMD = 'normal! l'
             \| else
             \|     let $CMD = '!find %f -type f %u'
             \| endif
             \| execute $CMD<cr>
by

I will surely find some way to reuse that escamotage condition until you implement that scenario! thank you, helpful as always

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