0

Removing Windows Newline Characters in Vim

Sometimes when working on projects in both Linux and Windows, a file will end up with Windows newline characters, which show up as ^M in Vim. Annoying as this is, there’s a quick fix to remove them in Vim using a regular expression replace:

:%s/<control-v><control-m>//g

Magically, all the ugly Windows newline characters are gone.

Copyright © 2010 — phup 'n stuff | Site design by Trevor Fitzgerald