vim每行结尾处的^ M [英] ^M at the end of every line in vim

查看:128
本文介绍了vim每行结尾处的^ M的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用vim和其他编辑器编辑源文件时,有时在该行的末尾,我在每行的末尾得到了这些^ M个字符.我认为这与在Windows中然后在Linux中编辑文件有关.如何自动删除所有这些内容?

When I am editing source files using vim and other editors sometimes at the end of the line I get these ^M characters at the end of each line. I think that it has something to do with editing a file in windows and then in linux. How can I remove all of these automatically?

推荐答案

作为命令,键入

:%s/^M$//

(要获取^ M,请按^ V ^ M,其中^是大多数键盘上的CTRL)

(To get ^M, press ^V ^M, where ^ is CTRL on most keyboards)

这篇关于vim每行结尾处的^ M的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆