Vim: View and remove carriage returns from file

Often you’ll find that files edited using IDEs or common editors add a ^M , carriage return, to the end of the line. To view and remove them just open file in vim and use


:e ++ff=unix

This will display all carriage returns, to remove them use

:%s/\r//g

Done