Vim在每一行结束时显示^M。

我如何用在Vim中打开的文件中的普通换行符替换它?


当前回答

在windows下,尝试:%s/<C-Q><C-M>/g

其他回答

^M是由Ctrl+V和M检索的

s/^M//g

只需删除二进制文件在你的。vimrc!

或者不使用vim,只需使用此命令修复换行符

fromdos <filename.txt>

希望能有所帮助!

这对我来说很简单

dos2unix   filename

这个函数保存跳转列表

fun! Dos2unixFunction()
let _s=@/
let l = line(".")
let c = col(".")
try
    set ff=unix
    w!
    "%s/\%x0d$//e
catch /E32:/
    echo "Sorry, the file is not saved."
endtry
let @/=_s
call cursor(l, c)
endfun
com! Dos2Unix keepjumps call Dos2unixFunction()