Sorting words (not lines) in VIM

后端 未结 6 510
长情又很酷
长情又很酷 2020-12-13 02:44

The built-in VIM :sort command sorts lines of text. I want to sort words in a single line, e.g. transform the line

b a d c e f

6条回答
  •  遥遥无期
    2020-12-13 03:03

    Maybe you preffer Python:

    !python -c "import sys; print ' '.join(sorted(sys.stdin.read().split()))"
    

    Visual select text, and execute this line.

提交回复
热议问题