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

I would like, by default, to sort in ascending order when sorting by name but descending when sorting by size and mtime (I've never ever wanted to find the smallest or oldest file, only the biggest and newest). Can this be set separately for each sort method?

1 Answer

0 votes
by

You can specify sorting order in 'sort' option with + or -. In sorting dialog you can press h to toggle ordering.

by

Yes, but that only affects the initial sorting, right? What I'm after is a setting by which I wouldn't have to change the order every time.
To be more concrete: I mainly/only use three different sort orders:
- iname, ascending
- mtime, descending
- size, also descending.
If I switch from name to time, I will have to change the order every time, would I not?

by

Yes, correct. Maybe you want a command to toggle sorting instead. Based on this question:

" toggle between sorting: by name <--> by size <--> by mtime
command! togglesort
         \ :if &sort == '-size,+name'
         \ |    set sort=-mtime
         \ |    echo 'Sorted by modification date'
         \ |elseif &sort == '+name'
         \ |    set sort=-size
         \ |    echo 'Sorted by size'
         \ |else
         \ |    set sort=+name
         \ |    echo 'Sorted by name'
         \ |endif
nnoremap <silent> ,S :togglesort<cr>

Or you could have several mappings for each sorting that you want to use, the examples of set sort are above.

...