On Oct 13, 6:56 pm, Charles E Campbell Jr <[email protected]>
wrote:
> Bee wrote:
> > sort bug?
>
> > vim 7.3.27 Linux
> > vim 7.3.21 Mac 10.4.11
>
> > Select the lines between the rules (including the blank lines) and
> > sort:
> > '<,'>sort n
>
> > "--------1---------2---------3---------4---------5---------6----
> > xxx yyy: 0
> > xxx yyy: 1
> > xxx yyy: 2
> > xxx yyy: 3
> > xxx yyy: 4
>
> > xxx yyy: 5
> > xxx yyy: 6
> > xxx yyy: 7
> > xxx yyy: 8
> > xxx yyy: 9
>
> > "--------1---------2---------3---------4---------5---------6----
>
> > The result is:
>
> > "--------1---------2---------3---------4---------5---------6----
> > xxx yyy: 0
>
> > xxx yyy: 1
> > xxx yyy: 2
> > xxx yyy: 3
> > xxx yyy: 4
> > xxx yyy: 5
> > xxx yyy: 6
> > xxx yyy: 7
> > xxx yyy: 8
> > xxx yyy: 9
> > "--------1---------2---------3---------4---------5---------6----
>
> > I would expect this and it is what I get when using the shell:
> > '<,'>!sort -n
>
> > "--------1---------2---------3---------4---------5---------6----
>
> > xxx yyy: 0
> > xxx yyy: 1
> > xxx yyy: 2
> > xxx yyy: 3
> > xxx yyy: 4
> > xxx yyy: 5
> > xxx yyy: 6
> > xxx yyy: 7
> > xxx yyy: 8
> > xxx yyy: 9
> > "--------1---------2---------3---------4---------5---------6----
>
> I tried your example and was unable to duplicate the problem.  Have you
> tried putting this in a file, say sort.test:
> vim -u NONE -N sort.test
> :%sort
>
> I tried that, and I tried using V and selecting all the lines, and each
> time I got the "I would expect this..." result.

Oops!
I was not paying attention and copied what you wrote.

Try it selecting the lines and
:'<,'>sort n

Do not forget the "n" numeric sort option.

With [n] sorting is done on the first decimal number
in the line (after or inside a {pattern} match).
One leading '-' is included in the number.

-- 
You received this message from the "vim_dev" 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

Raspunde prin e-mail lui