CotEditor can handle multiple types of line endings. In normal editing, it uses one line-ending type consistently for each document.
CotEditor treats the following characters as line ending delimiters:
| Label | Unicode name | Code point | Metacharacter | Description |
|---|---|---|---|---|
| LF | Line Feed | U+000A |
\n | The standard line endings in UNIX and modern macOS. |
| CR | Carriage Return | U+000D |
\r | The line ending used in classic Mac OS. |
| CRLF | – | U+000D U+000A |
\r\n | The combination of CR and LF line endings. Used mainly in Windows. |
| NEL | Next Line | U+0085 |
A legacy line ending character used mainly in EBCDIC, a family of character encodings by IBM. Hidden by default. |
|
| LS | Line Separator | U+2028 |
A control character indicating the separator of lines in Unicode. Hidden by default. |
|
| PS | Paragraph Separator | U+2029 |
A control character indicating the separator of paragraphs in Unicode. Hidden by default. |
The latter three types, NEL, LS, and PS, are rarely used as line endings in practice. Therefore, CotEditor hides them by default in the line ending choices.
Note: Although VT (U+000B) and FF (U+000C) also break lines visually in CotEditor, they aren’t treated as line ending characters.
Go to the CotEditor app
on your Mac.
Choose CotEditor > Settings, then click Format.
Select the “Default line endings.”
The default line endings setting is used for new documents and when an opened document doesn’t contain any line endings.
CotEditor detects the line endings used in a document automatically. When you open an existing document, the app uses the most common line ending in that document as the line ending for further editing.
You can check the line ending used in the document in the following places:
The label of the Line Endings pop-up menu on the right side of the status bar
The Text Settings section in the Document Inspector, which you can open by choosing View > Inspectors > Document
The selection of the Line Endings submenu in the Format menu
If a document has inconsistent line endings, CotEditor alerts you and highlights them. For details, see Find inconsistent line endings.
In the CotEditor app
on your Mac, open a document.
Open the Line Endings menu either in the status bar or in the Format menu.
Select the line ending.
To convert the document line endings to a hidden one, such as NEL, LS, or PS, open the Line Endings menu while holding the Option key.
In general, CotEditor uses only the document’s line ending so that you don’t need to care about differences among line-ending types. Even if you insert text containing different line endings, such as through a CotEditor script or a regular-expression replacement, CotEditor implicitly converts all line endings in the inserted text to the document’s line ending.
CotEditor provides the following two ways to insert line endings different from the document’s line ending:
Manually enter a line ending character by its Unicode code point.
Paste text containing some different line endings with the Paste Exactly command.