Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better support for g:netrw_sort_options #853

Closed
wants to merge 1 commit into from

Conversation

netj
Copy link

@netj netj commented Jun 8, 2016

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 the g:netrw_sort_sequence setting. Instead, by sorting twice, first with user's g:netrw_sort_options when necessary, then by the priority prefix assigned based on the g: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 sophisticated g: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 the g: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.

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 the `g:netrw_sort_sequence` setting.  Instead, by sorting twice,
first with user's `g:netrw_sort_options` when necessary, then by the
priority prefix assigned based on the `g: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
sophisticated `g: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 the `g:netrw_sepchr` and the optional dot (using :sort's r
option), `g:netrw_sort_sequence` setting is lost.  For more concrete use
case, see: https://github.com/tpope/vim-vinegar/pull/36/files#diff-412728b12a54e8fc2395cc4e67869028R112

Closes vim#233 by rebasing the patch on latest master.
@brammool
Copy link
Contributor

This is old and not for Vim itself. Let's close it now.

@brammool brammool closed this Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better support for g:netrw_sort_options
4 participants