Reverse a word in Vim

前端 未结 10 1524
南方客
南方客 2021-01-17 11:16

How can I reverse a word in Vim? Preferably with a regex or normal-mode commands, but other methods are welcome too:

word => drow

<
10条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-17 11:37

    If you have rev installed (e.g. via MSys or Cygwin) then it's really not this difficult.

    Select what you want to reverse and filter (%! ) it:

    :%! rev
    

    This pipes your selection to your shell while passing it a command.

提交回复
热议问题