Normally, a line such as
:map g :w would have a literal ^M ending, to allow the user's map-command to complete without having to press Enter.
If the .vimrc is short enough, e.g., consisting only of a few lines, where the majority have ^M endings, vim will guess that the file uses DOS (carriage-return / line-feed) endings, and store updates to the file using that convention — throughout.
For further reading
- 23.1 DOS, Mac and Unix files (Vim documentation)
- fileformats (Vim documentation)
- File format (Vim wiki)
- Convert DOS line endings to Linux line endings in vim
The file .vimrc is like any other text file: vim will guess its line-endings when reading it. In fact, you should be able to make a file containing two ^M's at the end of the original file: (1) for ending the map command, and (1) for ending the lines.