Re: Sort a set of lines
> Otherwise, on unix, a simpleIt will work on Windows/Dos as well, as there's a "sort" command there
> :'<,'>!sort sould do it.
as well...a tad more braindead, as it doesn't allow for all the nice
parameters you can pass to unix/gnu "sort", but for simple
alpha-sorting, it will suffice. If you want numerical sorting or sorting
by characters other than in the first position, you'll likely have to
install cygwin or one of the other ports of GNU tools to Win32.
- Giorgos Gaganis wrote:
> I would like to sort a few lines in a buffer. I have looked at tipWell, tip 588 refers to
> #588 but didn't help me much because I couldn't find the scripts it
> refers to.
> Any help would be greatly appreciated.
http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs (see "Visual
Block Sorting" -- the topics are in alphabetical order). The original
tip refers to my old website; you'd have to look at the "Additional
Notes" to see the new website, as we cannot edit our tips. Wish we
could! That said, the tip is referring to using visual block-based
based sorting (ie. use ctrl-v to select a rectangular region). One can
sort lines based on just the text in a column, or sort just the contents
of the column (leaving the text outside of the column alone).
It seems you want to do some straight sorting of whole lines. If you
have a decent external sort program, perhaps
where you pick the range (ie. :25,43!sort to sort lines 25-43
inclusive). If you happen to be using vim 7.0, then the built-in sort
command is available: