On Mo, 02 Nov 2020, Dominique Pellé wrote:
> 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 basically added the v:collate variable to be consistent with the other
v: variable, like v:lang and v:ctype and v:lc_time variable and I think
it is easier to get the current locale using those variables instead of
having to redir the :language [type] subcommand.
I remember that I intentionally left out the :sort and sort() functions,
because I wanted to fix the immediate problem first and left the rest
back then alone, wanting to do it later. It seems I forgot :( so thanks
for adding that.
> I also wonder whether there are other commands or
> functions that could use collation order besides
> readdir(), readdirex(), sort() and :sort.
Possible. I suppose if we need those, we can always enhance it further.
Best,
Christian
--
Stilblüten aus Schreiben von Versicherungsnehmern:
Ich bin von Beruf Schweißer. Ihr Computer hat an der falschen Stelle
gespart und bei meinem Beruf das w weggelassen.
--
--
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/20201102083320.GA32622%40256bit.org.
Monday, November 2, 2020
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment