In vim search and replace, newline is rendering as "^@"

This question already has an answer here:

  • How to replace a character by a newline in Vim? 11 answers

  • In :s 's replacement field, you need to use r not n for newline characters.

    ^@ is the ASCII null character. Vim internally uses r for newlines (which is ^M), and n for ASCII null, so in the replacement, if you use n you're getting those null characters instead of newlines. See also :h sub-replace-special

    链接地址: http://www.djcxy.com/p/49324.html

    上一篇: 用回车替换回车^ M

    下一篇: 在vim中搜索和替换,换行符被渲染为“^ @”