vim-sort-motion icon indicating copy to clipboard operation
vim-sort-motion copied to clipboard

Sort comma separated list without parenthesis

Open majkinetor opened this issue 9 years ago • 2 comments

This could be done

  • via selection
  • from the cursor up to specific char.

For instance I would like to sort people in markdown table:

|...| ...| Simone, Dean, Jane, Ana | ... |

In this case I could select entire cell and gs, or not select anything but gs,|. The end char cold even be specified in some array, i.e. let stopchars = '()|[]{}-' in which case above example becomes only gs,. Even , can be dynamic for instance gs- to sort Simone - Dean - Jane - Ana

majkinetor avatar May 27 '16 13:05 majkinetor

Hey @majkinetor, this is an interesting idea. Thanks for sharing! From an implementation standpoint I think we'd need to limit to commas (although we could have alt mappings for other delimiters), but gst] for sorting until ] makes sense to me.

I don't have a ton of need for this, but feel free to take a stab at implementing if you're interesting and I'll be happy to review.

christoomey avatar Jun 03 '16 01:06 christoomey

Normal Vim philosophy is to use the f and t movements. In you case place the cursor at the first item and then gst| should just work. This is how all other vim motion commands work when dealing with non brackets/quotes.

sukima avatar Sep 29 '17 18:09 sukima