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.
There is a conf in gedit that can correct your problem : You can modify it by typing
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
And change
ensure-trailing-newline
to falseThe following editors do not add a trailing newline character, if there is none,
You can install both via the repositories
(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.