I keep getting the ^M character in my .vimrc and it breaks my
configuration.
I keep getting the ^M character in my .vimrc and it breaks my configuration.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Unix uses 0xA for a newline character. Windows uses a combination of two characters: 0xD 0xA. 0xD is the carriage return character.
^Mhappens to be the way vim displays 0xD (0x0D = 13, M is the 13th letter in the English alphabet).You can remove all the
^Mcharacters by running the following:Where
^Mis entered by holding down Ctrl and typing v followed by m, and then releasing Ctrl. This is sometimes abbreviated as^V^M, but note that you must enter it as described in the previous sentence, rather than typing it out literally.This expression will replace all occurrences of
^Mwith the empty string (i.e. nothing). I use this to get rid of^Min files copied from Windows to Unix (Solaris, Linux, OSX).