22

I'm frequently running into line ending issues with my JetBrains Rider 2018.1 installation under Windows 10. The IDE turns existing LF files into CRLF files once I edit them. I haven't yet found a way to configure it the way I want.

I would like to always only have LF in my files (for new ones and for edited ones). During a commit process, I don't want to get distracted by line ending changes.

My git is set to core.autocrlf=input. So it should behave neutral and use the as-is settings.

I know I can edit each file manually via the Line Ending switch button on the bottom right of the editor, but I feel that is quite cumbersome.

Robert
  • 1,710
  • 2
  • 18
  • 35
  • The answers here apply to your case: https://intellij-support.jetbrains.com/hc/en-us/community/posts/205969644-How-to-Ensure-Always-LF-not-CRLF-on-Windows – CrazyCoder Jun 07 '18 at 18:41

1 Answers1

36

To change the default line ending for new files, Go to FileEditorSettingsCode Style and in the "Line Separator" dropdown select "Unix and OS X (\n)".

To change the line endings of existing files, select the files in the "Project" view panel, then go to FileLine SeparatorsLF - Unix and OS X (\n). Make sure you don't break anything though - some file formats (eg .bat) only work with specific line endings.

steampowered
  • 11,809
  • 12
  • 78
  • 98
andrej88
  • 847
  • 7
  • 13
  • I know. I tried that. I edit the file again and it switches back to CRLF again although I set it to LF before. – Robert Jun 14 '18 at 10:20
  • 3
    @Robert If you go to Code Style, there should be a "Scheme" dropdown at the top where you can select "Default (IDE)" or "Project". Perhaps one of them has line endings still set to CRLF and is overriding the other? – andrej88 Jun 14 '18 at 17:36
  • 1
    Just a warning for Unity3D users - setting the line endings for files can trigger a global asset reimport without warning, which can take ages and it just a pain. – Gregory Fenn Sep 22 '20 at 08:28
  • 1
    I had this same issue and finally figured out that the `.editorconfig` file for the project had. `end_of_line = crlf` this was silently overrides rides settings. – willbush Nov 16 '22 at 22:06