It is pretty common to create, edite and exchange source files between Windows, Linux and Mac computers. The newline markers in text files are different on all these three systems. Sometimes, this leads to funny looking characters when files are created on one system and opened on another. Typically, the
unix2dos tools are used to convert text files between these formats.
In Vim, it is easy to convert the end-of-line markers of a file to that of Windows, Linux or Mac. This is done using the fileformat option.
To view the end-of-line markers of the currently open file:
To set the end-of-line markers of the file to Windows:
To set the end-of-line markers of the file to Linux:
To set the end-of-line markers of the file to Mac:
After changing the newline markers, save the file.
Tried with: Vim 7.3 and Ubuntu 12.04 LTS