Eclipse is an IDE of choice for many. It's been very popular among Java developers for a long time, but lately it is getting some traction in the PHP world, as well. A big contributor has been the absolutely fabulous Eclipse PDT project that makes Eclipse PHP-intelligent.

Whether you are developing in Java, PHP or any other language Eclipse supports, you most probably have to deal with cross-platform issues. One of the most trivial, yet annoying is the matter of line-delimiters. For whatever historical reasons Windows, Unix/Linux and Macintosh use different delimiters. It almost makes you wonder if the creators of the three major operating systems were sadistic enough to intentionally employ all three possible variations to make our lives more difficult.

To avoid ugly problems, it is essential to make sure all developers on a project have the same settings for line-delimiters. Usually, teams use Unix version for two major reasons. First, both Windows and Macintosh understand it and mostly treat well. The second reason is related to version control. Most popular version control systems - CVS and Subversion are usually installed on Unix/Linux. In such case using Unix line delimiting makes sense.

How can we set up Eclipse to use Unix file delimiter even on OS-X or Windows?

To set up default ending for new files created, across the entire workspace:

Window -> Preferences -> General -> Workspace -> New text file line delimiter.

To convert existing files, open file for editing and for the currently edited file, go to the menu:

File -> Convert Line Delimiters To 

and select Unix.