How to replace a character for a newline in Vim?

来源:互联网 发布:智能家庭解决方案知乎 编辑:程序博客网 时间:2024/06/16 15:13


down vote
fav

I'm trying to replace each , in the current file by a new line:

:%s/,/\n/g 

But it inserts what looks like a ^@ instead of an actual newline. The file is not in DOS mode or anything.

What should I do?

EDIT: If you are curious, like me, check the question Why is \r a newline for Vim? as well.

Use \r instead of \n.

0 0
原创粉丝点击