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.

Can I specify sorting per directory?

0 votes
asked May 12 in vifm by nishant.varma
edited May 12 by nishant.varma

I am using set sort=-name at the moment becaus alphabetical order is the easiest way to find something in normal folders, but I need sort=-mtime in the Downloads folder since I need the latest file usually.

Is there some way I can achieve this?

Currently I am doing the following which looks a bit hacky because I don't see a DirLeave event:

autocmd DirEnter * set sort=+name
autocmd DirEnter ~/Downloads set sort=-mtime

1 Answer

+1 vote
answered May 12 by xaizek
selected May 12 by nishant.varma
 
Best answer

Use :setlocal:

autocmd DirEnter ~/Downloads setlocal sort=-mtime

Local options are automatically reset to global values when you change directory.

commented May 12 by nishant.varma

Ah, I should have thought about that! Thanks @xaizek.

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