0

Due to security, tight control of user rights, and understaffed IT, I have very limited opportunities to upgrade my Cygwin installation. I am using netrw version v149 plugin for vim, which sorts files like so:

20181217.1904+20190101.1954.zip*
20181217.1904+20190102.1731.zip
20181217.1904.zip*

I find this odd, since bash lists the files like so:

20181217.1904.zip*
20181217.1904+20190101.1954.zip*
20181217.1904+20190102.1731.zip

In both cases, the sort is by file name, in ascending order. However, the netrw sort seems to treat the "+" character as preceding ".", while the reverse is true in the bash sort.

I find the latter to be much more useful, and wonder how it is that the plugin is using a different character precedence. Is there a simple and pain-free way to get the second sorting scheme in netrw v.149?

user36800
  • 2,019
  • 2
  • 19
  • 34
  • For me, both `ls` and netrw sort like in your first output. ASCII `+` (decimal 43) comes before ASCII `.` (decimal 46), so this looks fine to me. I don't think there's anything wrong with netrw, nor that you can influence that particular behavior there. – Ingo Karkat Jan 09 '19 at 10:31
  • Hope I wasn't implying that netrw was wrong. The different sort behaviours were just an observation, with the second one being more useful for me. You might be right about there being no way to change the netrw behaviour. I'd be more certain of that, however, if I knew what was behind the difference in behaviour. – user36800 Jan 10 '19 at 19:19

1 Answers1

0

This can be done. Like open say the directory which contains these files in vim. Then:

Use the r key to set Reverse sorting order.
Then press the s key to sort using a particular style : by name, time or file size.

Hope this helps you somehow mate.

EDIT : If you want to persist say the reverse order and the particular style all the time, then add these to your vim config file :

let g:netrw_sort_by="time"                 "this chooses the style of sorting  
let g:netrw_sort_direction="reverse"       "this persists reverse sorting
Yedhin
  • 2,931
  • 13
  • 19
  • I'm sorry, but I don't think I was explicit enough in my question. I've added a paragraph explaining that both schemes sort by name in ascending order, but the punctuations seem to be treated differently. – user36800 Jan 04 '19 at 05:02