^M 在 vi​​m 中每一行的末尾 [英] ^M at the end of every line in vim

查看:12
本文介绍了^M 在 vi​​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)

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

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