machakann/vim-swap

Sort not working as expected with numbers

viniciusmuller opened this issue · 2 comments

Trying to gss on:

(1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 9, 34, 2344, 23)

result:
(1, 1, 2, 2, 23, 2344, 3, 3, 34, 4, 5, 5, 6, 9)

expected:
(1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 9, 23, 34, 2344)

Thanks. This is because vim-swap compares the items as strings, not as numbers.

Indeed, this is not intuitive... I will make it better. Probably, treat numbers (\d\+) as special.

before:
(1, 12, 2)

after:
(1, 2, 12)


before:
(1, 12, 2, b, ab, a)

after:
(1, 2, 12, a, ab, b)

Updated.