Vim remove ^M

I’m always needing to remove ^Ms in vim and forgetting the command - heres the details:

The stuff to type in

:%s/ctrlkey+v then ctrlkey+M//g

What appears in the vim command line

:%s/^V^M//g

Note:

  • ^Ms appear in your files after edits in Windows
  • In the comments on Google+ Kae has pointed out that you can just enter %s/ctrlkey+v then enter//g to remove the ^Ms as well

Justin Kelly

Justin Kelly

Web Developer, Business Analytics, Data Engineer specialising in PHP and Tableau

Based in Melbourne, Australia

Feel free to contact me justin@kelly.org.au or _justin_kelly

Leave a comment

Name Notify me of replies by email.