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

Hello there, the android file manager Mixplorer has a function where you can pin a folder to the top, so a folder would show even above an alphabetical order as the first folder. I'm trying to think of a way to get that same functionality in vifm. Is this possible?

Thank you!

1 Answer

0 votes
by

Hi,

You could probably abuse group sorting for that, for example:

autocmd DirEnter / setl sort=-groups,dir,name sortgroups='^(tmp)$'

This moves /tmp directory to the top of the list because it's the only one with non-empty group match. Multiple directories can be listed in 'sortgroups' regexp as well.

It has implications for things like :sort dialog and overwriting current sorting which might or not be relevant for your use cases. Something like let &l:sort = '-groups,dir,' . &g:sort should address part of it:

autocmd DirEnter / let &l:sort = '-groups,dir,' . &g:sort | setl sortgroups='^(tmp)$'
...