Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make IntelliJ IDEA insert a new line at every end of file?

How do I make IntelliJ IDEA insert a new line at every end of file, so that GitHub doesn't complain for example?

like image 390
NightRa Avatar asked May 26 '13 16:05

NightRa


People also ask

How do I add a new line in IntelliJ?

There are shortcuts for this in IntelliJ IDEA! Simply hit Shift+Enter to start a new line below the current line or Ctrl+Alt+Enter (⌥⌘Enter on Mac) to start a new line above the current line.

Why is Newline required at end of file?

The way Unix regards its general behavior at the end of files is as follows: \n characters don't start lines; instead, they end them. So, \n is a line terminator, not a line separator. The first line (like all lines) needs no \n to start it. The last line (like all lines) needs an \n to end it.

What is the line in IntelliJ for?

Basically, it's the guide line showing where the wrapping will occur (if enabled for certain code constructions). Show activity on this post.


1 Answers

Change your Editor settings:

Settings → Editor → General → Ensure line feed at file end on Save

like image 142
NightRa Avatar answered Sep 28 '22 23:09

NightRa