vim: replace the windows ^M character under Linux

Within VIM, there is a way to replace all the return carriage from Windows (that appear as ^M) by replacing them with the Linux version:

% s/^M/\r/g

When \r stands for the return carriage in Linux (not \n as C users would expect) and ^M is not a concatenation of the characters ^ and M but a special character create by typing “Ctrl+V Enter” in VIM.

Please follow and like us:
This entry was posted in Computer Science and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *