Vim Removing “^M” Returns from Files
Posted on In LinuxWhen editing some files fro Windows in vim, there are some ugly “^M” returns. Here is a method to remove and replace these “^M”s (please note that you should not copy/past to use the follows):
:1,$s/{Ctrl+V}{Ctrl+M}//{Enter}
{Ctrl+V} means keyboard operation that is push ‘ctrl’ and ‘v’ together. {Enter} is push ‘enter’.
: means that it is a ex command.
1,$ means that the line number range is from the first line to the last line.
{Ctrl+V}{Ctrl+M} is the “^M”. {Ctrl+V} tells the vim to treat the next character as regular character.