The end of the line is a symbol, which breaks the text lines into new rows. Many computer users don’t even realize that there is such a thing. It is invisible and it makes sense to be so because we don’t need to edit it.
However, it has 3 different formats which are CRLF
, LF
and CR
.
For a normal user, it does not matter which one they’re using by default. But for programmers, this can be a real headache when the software stops working. As an example, in another post we have the same problem generated exactly by the EOL symbol.
What is the recommended EOL symbol?
Generally speaking, it depends on what you are doing. If your code will be running on Windows only, then probably crlf
would make more sense. But if your code is going to be running on Linux, then it should be lf
.
How to change the EOL in VSCode?
Open the desired file and in the bottom-right corner, you’ll find an indicator that shows the current EOL. Click on it and a menu will pop up. Select the new end of line symbol and save the file. That’s it.
The following screenshot illustrates the process:
How to change the EOL in Jetbrains IDE (PHPStorm, WebStorm, etc)?
In any Jetbrains IDE, the process is similar to what we did in VSCode.
Open the desired file and in the bottom-right corner, you’ll find an indicator that shows the current EOL. Click on it and a menu will pop up. Select the new end of line symbol and save the file. That’s it.
The following screenshot illustrates the process:
How to change the EOL in Sublime Text?
It’s a bit different from what we did in the above IDEs, but not too complicated.
Open the desired file and from the top menu select View -> Line Endings and then the Windows(CRLF) or Unix(LF). That’s it.
The following screenshot illustrates the process: