用换行符全局替换所有^ M.

时间:2015-10-06 06:30:07

标签: vim replace newline vi

我有一个fileformat=dos的文件,其中vim将所有换行符显示为^M。但是,当我尝试通过使用

替换所有^M \r来解决此问题时
:%s/<Ctrl-V><Ctrl-M>/\r/g

然后命令不是全局执行,而是在替换第一个^M字符后停止?

1 个答案:

答案 0 :(得分:3)

I found the answer thanks to Micheal's comment:

Are the gdefault or edcompatible options off? Read :help s_flags.

After setting :set nogdefault the substitution is now global.