Unix uses 0xA for a newline character. Windows uses a combination of two characters: 0xD 0xA. 0xD is the carriage return character. ^M happens
to be the way vim displays 0xD.
You can remove all the ^M characters
by entering the following:
:%s/^V^M//g
where ^V^M means CTRL+V,CTRL+M and
is a way to entering characters ^M into
vi. It will globally replace all occurrences of ^M with
nothing.
本文介绍了如何在使用vim编辑器时去除文本文件中的^M字符。这些字符通常出现在从Windows系统复制到Unix或Linux系统的文本中。通过执行特定的vim命令可以全局删除这些不必要的^M字符。
632

被折叠的 条评论
为什么被折叠?



