Can newlines be configured? (eg. \r\n or \n)


I haven’t been able to find a proper setting for this, and it seems like Atom is putting newlines as \r\n, which is different from the rest of my file, which is all \n.


I haven’t found any way to change the standard yet (and I’m personally not fussed with the behaviour either way), but there is at least a package that allows you to convert them:

For a more permanent solution you might be able to convince someone to make a package that will let you change this setting.


You can put this in your init script. I abstracted this from the line-ending-converter package. This will convert your newlines automatically when you save a file.

targetEolFormat = "\n"
{Range, Point} = require 'atom'

atom.workspace.observeTextEditors (editor) ->
	buffer = editor.getBuffer()
	buffer.onWillSave ->
		lastRowIndex = buffer.getLastRow()
		buffer.transact ->
			for rowIndex in [0...lastRowIndex]
				currEol = buffer.lineEndingForRow rowIndex
				if currEol isnt targetEolFormat
					lineEndingRange = new Range(
						new Point(rowIndex, buffer.lineLengthForRow(rowIndex)),
						new Point(rowIndex + 1, 0)
					buffer.setTextInRange lineEndingRange, targetEolFormat, false


Thank you. I would expect this to be an actual application setting at some point though, no?


If anyone finds this thread from a search like I did, there is an open issue for this


This topic is a duplicate of a prior topic:

We try to keep all the discussion on a particular item in a single location so that people don’t have to go hunting around for all the threads to understand what has been said. Closing this as duplicate.

closed #7