[vim/vim] netrw v165 seems to ignore sort sequence (#4832)

165 views
Skip to first unread message

François Ingelrest

unread,
Aug 19, 2019, 2:36:53 AM8/19/19
to vim/vim, Subscribed

I recently updated my vim to v8.1.1888, including netrw which is now v165.

When sorting by name directories and files are now mixed up, which was not the case before.

I'm not sure whether this is a bug or if I didn't get how to use g:netrw_sort_sequence, but this variable seems to be ignored which could be the cause of the initial issue. I've tried various sequences including the default one, but the file listing seems unaffected.

Please see the following screenshot:

netrw

As far as I can tell, the sort sequence should move directories first, then jpg files, then pdf files. The listing is unaffected and sorted solely by name. :h netrw-sort-sequence clearly states that this variable should be used when sorting by name.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub

shane.xb.qian

unread,
Aug 24, 2019, 11:29:34 AM8/24/19
to vim/vim, Subscribed

btw, looks the 'g:netrw_liststyle' did not work as well ..
though the cmd 'i' would be able to change the listing style still ..
so probably it can be handled with this together ...
my version is v8.1.1845

  • shane

Shrikant Sharat Kandula

unread,
Sep 6, 2019, 1:44:23 AM9/6/19
to vim/vim, Subscribed

It looks like this happens only for details view (i.e., liststyle = 1). It seems to be working fine in other listing styles.

François Ingelrest

unread,
Sep 6, 2019, 1:58:38 AM9/6/19
to vim/vim, Subscribed

Right, I can confirm that this happens with the detailed view.

shane.xb.qian

unread,
Sep 6, 2019, 2:09:22 AM9/6/19
to vim/vim, Subscribed

It looks like this happens only for details view (i.e., liststyle = 1). It seems to be working fine in other listing styles.

looks no, my current default setting is 'netrw_liststyle = 3', but it did not work fine.
my cur vim version is v8.1.1943

Shrikant Sharat Kandula

unread,
Sep 6, 2019, 5:58:25 AM9/6/19
to vim/vim, Subscribed

I think I found the problem. In the following line:

https://github.com/vim/vim/blob/6f72e90dd843a7342395b31f31c2073a3859869d/runtime/autoload/netrw.vim#L8900

Change the \t in the replacement string to \\s and it should start working. This might still fail when dealing with files with spaces. I think that was the reason for using \t here, but it won't work because the long-list rendering currently doesn't use tabs.

I'm not raising a PR since I'm not sure of this. I'm putting it here so someone better informed can take a call.

Shane-XB-Qian

unread,
Sep 17, 2019, 4:24:54 AM9/17/19
to vim/vim, Subscribed

looks that due to 'list hide' that (code/rule) was sth changed, if it's 'tree', there maybe some 'space' ahead the file/dir name, not sure why now it made that do not work as expected.
when redraw the 'list hide', it works fine now - i mean the 'liststyle = 3', probably the issue you faced about 'sort' was related.
so sometime some code modification were contextual related unless the original author knew the all. :)
btw, if the dir was a 'link', the behaviour in the 'vim' itself and 'netrw' looks a little different, and in the linux and windows/cygwin maybe a little different too, but looks 'netrw' handle it well, just saying that sometime impact the result a little expected too ...

Shane-XB-Qian

unread,
Sep 22, 2019, 11:36:54 AM9/22/19
to vim/vim, Subscribed

the rule was '^..*' and worked in the past.
looks the 'space' now is counting.

Shane-XB-Qian

unread,
Sep 22, 2019, 11:37:15 AM9/22/19
to vim/vim, Subscribed

'^..*'

Shane-XB-Qian

unread,
Sep 22, 2019, 11:38:32 AM9/22/19
to vim/vim, Subscribed

um... the github ate an 'escape' after '^'. -_-#

Shane-XB-Qian

unread,
Sep 22, 2019, 11:40:58 AM9/22/19
to vim/vim, Subscribed

'^\..*'

Shrikant Sharat Kandula

unread,
Sep 24, 2019, 2:27:40 AM9/24/19
to vim/vim, Subscribed

The rule ^\..* won't have a problem with the bug reported in this issue. You'll only be affected if your patterns use the $ atom.

PS: Use the backtick marks to wrap code in your comments and GitHub will not remove backslashes. See https://guides.github.com/features/mastering-markdown/.

Shane-XB-Qian

unread,
Sep 24, 2019, 2:46:34 AM9/24/19
to vim/vim, Subscribed

just saying that's in 'doc' it would hide the 'hiding' files/dirs if such rule, if i did not recall wrong.
but now, looks the code changed (a lot), it would hide all (if listtype=3) now, or maybe a bug.
sorry jumping here :) maybe mess-up the original question here, but just saying netrw looks changed a lot - not stable - that's in common which we faced. :)

Shane-XB-Qian

unread,
Sep 24, 2019, 2:56:11 AM9/24/19
to vim/vim, Subscribed

or maybe an improvement ?! :)
since that rule would be treat as '\.' as well, maybe now it's saying it's hiding the current dir all.
all in all, just saying netrw changed a lot which maybe not back-compatible. bad news or good news ? :)

Richard Robbins

unread,
Oct 25, 2019, 9:42:33 PM10/25/19
to vim/vim, Subscribed

The issue is that the sort regex is being applied to the entire line in the long list format, rather than just the filename. Here's an illustrative example:

4 Files in alphabetical order with sort by liststyle=1

abc                                            0 Wed 25 Sep 2019 12:00:00 AM PDT
def                                            0 Fri 25 Oct 2019 12:00:00 AM PDT
ghi                                            0 Mon 25 Nov 2019 12:00:00 AM PST
jkl                                            0 Wed 25 Dec 2019 12:00:00 AM PST

But if I configure let g:netrw_sort_sequence = '.*Oct.*', I get:

def                                            0 Fri 25 Oct 2019 12:00:00 AM PDT
abc                                            0 Wed 25 Sep 2019 12:00:00 AM PDT
ghi                                            0 Mon 25 Nov 2019 12:00:00 AM PST
jkl                                            0 Wed 25 Dec 2019 12:00:00 AM PST


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Richard Robbins

unread,
Oct 25, 2019, 9:43:22 PM10/25/19
to vim/vim, Subscribed

Also, as a good enough work around until this is addressed, I'm just going with something like let g:netrw_sort_sequence = '[\/]\s'


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Reply all
Reply to author
Forward
0 new messages