2

I'm writing bash shell scripts with Unix line endings using notepad++. However, the final line never contains a new line. I must manually create it by pressing "enter" and having a blank line in my document.

How can I configure Notepad++ to always have a newline (line feed) at the end of all lines?

  • What "blank line" are you referring to? My Notepad++ has no such thing. And just how is Notepad++ supposed to determine when the line is ended, unless you tap that return key? – kreemoweet Nov 7 '13 at 6:08
  • Unix scripts in notepad++? This feels weird – Bruno9779 Nov 11 '13 at 14:05
  • I use windows and *nix at work, and so notepad++ is my preferred editor, as it has sftp and explorer plugins which I use extensively. No, not weird. – Felipe Alvarez Nov 13 '13 at 1:40
  • Vim adds \n to the end of every line. It doesn't need to know anything – Felipe Alvarez Nov 13 '13 at 1:40
6
+50

You will have to press Enter after the last line.
That extra blank line in Notepad++ is just visible in the editor.
It isn't really putting any data in the output file. (Besides the EOL character that you want.)

P.S. It doesn't matter whether you use Windows, Unix or Mac line-endings. The behavior of Notepad++ is the same for all three. You will have to add the "extra" blank line in order to get the EOL character appear on the line above it.

| improve this answer | |
-2

For every end-of-line, Notepad++ will insert just one byte as line feed. This is just like VI editor in Unix/Linux. In contrast, Windows-Notepad will insert CR+LF characters (0D and 0A Hex values) as new line.

Just like the above storage-optimization, new line will not be inserted at end of file in Notepad++. We have to insert it manually before saving.

| improve this answer | |
  • vi adds \n to the end of each line. no final blank line needs to be created. All lines end with \n. – Felipe Alvarez Nov 13 '13 at 1:39
  • Yes. That \n is newline, which is a single-byte. – R Rajendhran Nov 19 '13 at 9:58
  • 2
    Notepad++ will insert either LF or CR or CRLF, so either one or two bytes at the end of each line. Which of those options it chooses depends on your settings. I think the default setting for a new Notepad++ installation even is CRLF, as that just makes the most sense on Windows systems for compatibility with other editors. Therefor I am afraid that that part of your answer is wrong. – Kaiserludi Oct 1 '15 at 11:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.