I\'m using gVim on Windows. My code shows ^M
characters at the end of lines. I used :set ff=dos
to no avail. The ^M
characters remain
You can also run:
:e ++ff=dos
To remove the ^M
: See File format – Vim Tips Wiki.
Actually what worked for me (on 64-bit windows, gVIM: 7.2 ) was:
:set ffs=dos
not just: ff
You can ignore these chars!
put this into your vimrc
match Ignore /\r$/
Running Vim 7.3 on Windows 7. I used the following command:
:%s/^M/\r/g
To create the ^M I typed in CTRL+Q then CTRL+M.
tried a lot of things but the following worked
:%s/\r/\r/g
note: use g if you want the effect on the whole file
I usually use the following to cleanup my line endings:
:g/^M$/s///
To get the ctrl-M I usually type ctrl-Q, then ctrl-M and it puts it in. (In some environments it may be ctrl-V then ctrl-M.) I don't know why, but I find that one easier to remember than rq's.
Don't forget to do :set ff=dos
as well, or you'll end up saving with UNIX line endings still.