Why is \r a newline for Vim?

后端 未结 5 2031
执笔经年
执笔经年 2020-11-27 09:30

From question How to replace a character for a newline in Vim?. You have to use \\r when replacing text for a newline, like this

:%s/%/\\r/g
         


        
5条回答
  •  囚心锁ツ
    2020-11-27 09:37

    From vim docs on patterns:

    \r matches

    \n matches an end-of-line - When matching in a string instead of buffer text a literal newline character is matched.

提交回复
热议问题