Line ending issues using VIM on MAC OS X

MAC OS X seems to be using unix-like line endings (LF) instead of the old mac line endings (CR). However if you use VIM (the one that comes preinstalled, at least in my macbook), you might get a surprise and get your files with dos-like line endings (CRLF). This can be a major issue if you are doing collaborations via svn for example, as a simple diff will show lots of ^M. The solution is shown here.

Basically add "set ffs=unix,dos" and "set ff=unix" to your vimrc file. However this will not make the trick for an existing file that already has the dos format. Please read the document linked above carefully for all the details.

back to other tutorials