3

Recently I discovered that, after years of thinking various software was adding a newline to the end of my files, it was actually Pluma (or Gedit - same difference) silently adding them all along. Currently I'm working on a website that will have lots of PHP includes, parsing data saved on disk and the likes, so it would make my life a lot easier to do away with the extra line added to the end of each file. As far as I can tell, there isn't a way to stop this behaviour.

I'd like to either get this sorted or find a text editor similar to Gedit without this issue. I don't really want to resort to using Notepad++ via Wine, but that may be an option. Terminal text editors are also a possibility but I'd rather use one with a GUI for anything more than minor edits to files.

2 Answers2

2

There is a conf in gedit that can correct your problem : You can modify it by typing

gsettings set org.gnome.gedit.preferences.editor ensure-trailing-newline false

If you don't like command line tools You can modify it using dconf-editor (sudo apt install dconf-editor if needed)

Then in dconf-editor go to

/org/gnome/gedit/preferences/editor

And change ensure-trailing-newline to false

Félicien
  • 1,203
1

The following editors do not add a trailing newline character, if there is none,

  • leafpad
  • emacs

You can install both via the repositories

sudo apt update
sudo apt install leafpad emacs24

(I checked in 16.04 LTS, and it was the package emacs24 for my emacs.)

Edit:

  • leafpad is a light-weight GUI editor, that comes with Lubuntu.

  • emacs is a classic editor originally from Unix, and it can be run both with a GUI and in a terminal window. It is very powerful, but has a learning curve.

sudodus
  • 47,684