Better support for g:netrw_sort_options
#853
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So far, only very limited things could be done by setting
g:netrw_sort_options
, because of the way sorting was done by prefixing every line with priority and a delimiter (g:netrw_sepchr
), which is to support theg:netrw_sort_sequence
setting. Instead, by sorting twice, first with user'sg:netrw_sort_options
when necessary, then by the priority prefix assigned based on theg:netrw_sort_sequence
setting, it's possible to respect both settings. When the sort direction is reversed, we can simply reverse the lines in the file listing range.For example, it's very difficult if not impossible to mix dot files with normal files in the Netrw's file listing (by ignoring the dot prefix of file names) using the
g:netrw_sort_options
, while still having a sophisticatedg:netrw_sort_sequence
setting. Because of the priority prefix, it's impossible to ignore the dot in the middle of each line with a :sort option. On the other hand, if :sort is done with what comes after theg:netrw_sepchr
and the optional dot (using :sort's r option),g:netrw_sort_sequence
setting is lost. For more concrete use case, see: tpope/vim-vinegar#36 (https://github.com/tpope/vim-vinegar/pull/36/files#diff-412728b12a54e8fc2395cc4e67869028R112)Closes #233 by rebasing the patch on latest master.