Keep line separators when editing files.

Hi,
I am working on a multi-platform project which stores its source files with LF endings. Each time I open one file under Windows, the endings are set to CRLF, which is not what I want. I want to maintain whatever line ending the file has.
I set the option Code style - General - Line separator (for new files) to "Unix and OS X (\n)", but this is just a fix for new files.
How can I keep the line separators when editing existing files? Or at least, how can I specify what line separator to use for existing files? All the information I got on the net was only about git and "autocrlf = true" option which I don't care about.
Thanks.

1 comment

IDEA will keep the line ending type currently used in a file. So if you open a Unix (\n) file, it will keep it a Unix file. A Windows file (\r\n) a Windows file. The one exception is if you open a file that has mixed line endings, it converts the file to (as far as I can tell) to what ever is the most prominent occurring line ending. In a tie, I think it uses whatever you have set for the line ending for new files.

You can change a file's line endings via the icon on the right side of the bottom status bar:

line-ending-icon-in-status-bar.png

There may be a plug-in in the plug-in repository for adjusting line endings in project files. If not good old unix2dos or dos2unix tool could be used.

0

Please sign in to leave a comment.