Gary Johnson wrote:
> On 2020-11-01, Dominique Pellé wrote:
> > Dominique Pellé wrote:
> >
> > > Tekki wrote:
> > >
> > > > Chris Jones schrieb am Samstag, 31. Oktober 2020 um 20:16:53 UTC+1:
> > > >>
> > > >>
> > > >> So what's the next step?
> > > >>
> > > >
> > > > You could create your own sort command in vimrc, for example
> > > >
> > > > command -nargs=1 Sort :.,+<args>!sort -
> > > >
> > > > Then :Sort7 will sort the above list of letters correctly.
> > >
> > > Indeed, you could use %!sort to use the Unix sort command
> > > instead of the Vim ex command (possibly replace % with
> > > another range if you don't want to sort the entire file).
> > >
> > > That said, sorting using the locale ordering with Ex :sort
> > > could be useful. I see that ex_sort() in ex_cmds.c calls
> > > sort_compare() and that function calls STRCMP() or
> > > STRICMP(). strcmp() not use the locale, but strcoll() does.
> > > We could consider adding a sorting option to honor the current
> > > locale (e.g. :sort l) which would compare using strcoll() instead
> > > of STRCMP or STRICMP.
> >
> > I just created a git pull request to implement sorting using the
> > current locale. It adds a l option to the :sort Ex command.
> >
> > See:
> >
> > https://github.com/vim/vim/pull/7237
>
> Is this consistent with Christian's fix for #6229 in June?
> I haven't looked at either patch closely--I just remembered that
> this issue had been discussed before--but they seem to take
> different approaches to setting the collation order. I don't
> particularly care how it's done, but I do care that it's done
> consistently.
>
> Regards,
> Gary
Hi Garry
I did not know or remember about Christian's patch
(vim-8.2.0988) which:
- introduced the read-only v:collate variable.
- and added an option using a dictionary parameter
to use collation order with readdir() and readdirex(),.
Christian's patch did not affect :sort or sort().
My patch 8.2.1933 introduced options to :sort and sort()
to use collation order.
I don't think there are inconsistencies. We could not
use a dictionary option to neither :sort and sort().
sort() already had a dict with different semantics.
That said, we could make minor clean-ups:
- the tests introduced by 8.2.1933 could check v:collate
instead of checking execute("language collate").
- and the doc of :sort and :sort() could link to v:collate.
I wonder whether we really needed to introduce the
read-only v:collate given that the existing ":language collate"
was sufficient to check the collation order.
I also wonder whether there are other commands or
functions that could use collation order besides
readdir(), readdirex(), sort() and :sort.
Regards
Dominique
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAON-T_jU7eF0HZUG%2Bt7osF9zzuRy8kW7vio1efFw7sw0OVre%3DA%40mail.gmail.com.
Sunday, November 1, 2020
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment