Choose newline character in Notepad++
Asked Answered
P

4

202

I notice that when I load a text file, Notepad++ will recognize and use whatever the newline character in that file is, \n or \r\n.

Is there some option where I can select which to use by default for new documents?
(I've looked in help and googled, but can't find anything.)

Postdiluvian answered 19/11, 2011 at 17:26 Comment(0)
A
348

For any new document: Settings -> Preferences -> New Document (left pane) -> New Document (right pane) -> Format (Line ending) -> Windows (CR LF) / Unix (LF) / Macintosh (CR)

And for an already-open document: Edit -> EOL Conversion

Analgesic answered 19/11, 2011 at 17:30 Comment(3)
But note: in the the current version this only works when you create a new file with NP++. If you create an empty file it still seems to default to \r\n (when it finds no EOL characters to go by), and use that instead.Zellner
In version 7.7.1 this seems to default to the proper new document preferences.Pedicular
You can also just double-click the format in the status bar and select the desired format. That's much easier than looking in the Edit menu. This also works in VSCode, with a single-clickTripos
S
85

"Edit -> EOL Conversion". You can convert to Windows/Linux/Mac EOL there. The current format is displayed in the status bar.

Stamford answered 19/11, 2011 at 17:31 Comment(3)
This is much betterEject
Upvoted just for mentioning the EOL format is shown in status bar (near bottom-right of default configured Notepad++ window).Afresh
You can also just double-click the format in the status bar and select the desired format. That's much easier.Tripos
I
4

on windows 10, Notepad 7.8.5, i found this solution to convert from CRLF to LF.
Edit > Format end of line
and choose either Windows(CR+LF) or Unix(LF)

Imprecation answered 4/6, 2020 at 11:19 Comment(0)
D
3

Just double-click on that EOL format in the status bar and select Unix(LF).
It's not possible to default save a file in this (LF) format.

How to change the EOL format in Notepad++.

Just an alternative to the "new document" setting mentioned earlier …

Dygert answered 5/8, 2021 at 20:43 Comment(3)
My guess is that the reason this answer has attracted downvotes is that this feature is no longer available in the versions of the last few years. I tried it in version 8.4.6 (32-bits), and it doesn't work.Siliceous
@Henke Seems to work for me, and I'm running the latest version.Beggary
32-bit or 64-bit? Maybe not relevant? When I have the time, I will update to the latest version to see if that makes any difference.Siliceous

© 2022 - 2024 — McMap. All rights reserved.