I was trying to use gedit, when I came across the following problem:
myPC@TM77:~$ sudo gedit /etc/pm/config.d/config (gedit:12512): IBUS-WARNING **: The owner of /home/myPC/.config/ibus/bus is not root! (gedit:12512): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
What is happening?
There is no problem with editing files as root using gedit. I do it often and always will use the following method, which is the correct way to use gedit with superuser permissions:
to edit a file with root permissions.
Not sure why the downvotes, since this was the only correct answer, the other said use another editor. So I'll tell and show you why.