Replace ^M windows line endings in vim

When files comes from windows sometimes there are ^M at end of all lines which marks line ending.

So to remove them from file type:


Where means type Ctrl+V then Ctrl+M.



substitute, % = all lines

`^M` characters (the Ctrl-V is a Vim way of writing the Ctrl ^ character and Ctrl-M writes the M after the regular expression, resulting to ^M special character) Replace: ```bash /\r/ ``` with new line (\r) ```bash g ``` And do it globally (not just the first occurrence on the line).

Leave a Comment