Re: Feature request: sort()
- Overcoming an impressive lethargy, Piet Delport <pjd@...> scribbled:
> On Wed, 04 Dec 2002 at 09:46:17 -0500, Benji Fisher wrote:Well, "sort" isn't a O/S level issue: it's a C language issue.
> > digitect@... wrote:
> >> Would it be a great effort to add a built-in sort() function to Vim?
> > I agree that sorting is important, but I think that including this
> > would be a step in the direction of Vim-OS, so it is unlikely to happen.
> > It should be possible to write a vim script that looks for an external
> > sort program and defines Sort() as a wrapper for it, or else implements
> > Sort() in vim script.
> Agreed, but consider that Vim already has things like hostname(),
> input*(), char2nr() tolower()/toupper(), and more. Vim is a text
> editor, and sorting text is a pretty fundamental part of text editing,
> compared to something like getting the machine's hostname.
VIM is rather closely bound to C already so a call to the standard C
library routine "qsort(3)" isn't likely to be unportable: it should be
part of the standard libary. If not, providing a work-alike is
simple since qsort(3) has been repeatedly ported and re-ported and
re-implemented almost since time began ;-)
>>>digitect@... wrote:[arguments for and against]
>>>>Would it be a great effort to add a built-in sort() function to Vim?
Thanks for the discussion. A few final points from me...
* External !SORT in my instance is too bothersome because of the
terminal window that is raised by gVim.
* Perl, ruby, python... nice, but require these installed, which is
hidden bloat anyway. I can't count on this. (That's what I meant by
overhead, not speed--sorry for not being clear.)
I'm trying to build an abstracted heirarchical tree display method,
with content abstracted from display and indented, multiple nodes open
at a time. I need the speed (depending on the application) for column
sorts with large data sets without the above restraints.
Steve Hall [ digitect(at)mindspring.com ]