34

How does one enforce a newline at end of file in RubyMine (v 4.5.3, on Mac OS)?
e.g., similar to Sublime Text 2

Marius Butuc
  • 17,781
  • 22
  • 77
  • 111

5 Answers5

45

Enable Ensure blank line before end of file on Save option in the Editor settings:

Ensure blank line before end of file on Save

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
8

RubyMine 2021.2

"Ensure every saved file ends with a line break"

enter image description here

Rich Steinmetz
  • 1,020
  • 13
  • 28
7

In RubyMine 6 or above (on Mac OSX):

Enable 'Ensure line feed at file end on Save' option in the Editor settings.

enter image description here

K M Rakibul Islam
  • 33,760
  • 12
  • 89
  • 110
4

RubyMine alongside many other editors supports the EditorConfig standard for basic configuration.

You can enforce newlines at the end of every file by placing a file named .editorconfig at the root of your project:

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

It's possible to disable the setting for specific file types or filenames.

Leo
  • 1,493
  • 14
  • 27
3

In RubyMine 2016.2.1 you have to go to Preferences > Editor > General > Other > Ensure line fedd at file end on Save. Screenshot of the Preferences in RubyMine 2016.2.1

Olga
  • 31
  • 1