[SOLVED] How do I change the default editor to use as root?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
How do I change the default editor to use as root?
How do I change the EDITOR environment variable so it stays changed? I already put a line
EDITOR=/bin/nano
in /etc/environment, and I also tried
sudo update-alternatives --config editor
to no avail; when I do gksu nautilus in Debian and open a config file I get abiword, and when I run the script "open as administrator" in Ubuntu I open Emacs if it is installed (I'd like to learn Emacs but not use it right away for simple editing tasks). How come? How can I make nano stick in all cases? I'll keep looking but have not yet found anything useful.
The EDITOR variable only counts for shell operations. In Nautilus you have to change the settings also. I am not using Nautilus, but I would think that it works somewhat similar as in thunar: Right-click on a text-file, then click on "Open with"->"Other application" and choose your application.
Thanks, TobiSGD. It is possible to make nano appear in the "Open with" window but it won't work. I just remembered something and edited /etc/gnome/defaults.list by replacing all instances of abiword.desktop with gedit.desktop. (Edited that file 2 years ago to replace totem with vlc). I will do that in ubuntu too and reinstall Emacs. The ubuntu root-sudo page also tells me of a drag-and drop sudo, a desktop launcher that reads
gksudo "gnome-open %u"
and will prompt for a password when you drag a file on it. For the record, the "open as admin" script is in $HOME/.gnome2/nautilus-scripts (at least in ubuntu) and goes
for uri in $NAUTILUS_SCRIPT_SELECTED_URIS; do
gksudo "gnome-open $uri" &
done
So I guess this is solved. I'll just go and see if this also works in Debian.
Thank you. I guess I was a bit confused about this. As for the script mentioned above, it also works in Debian (make it executable). Also for the record, I know that you know all this but some people who read this might be interested. It seems I keep answering my own questions, assuming they might be of some interest. I hope this is okay.
Last edited by nokangaroo; 03-28-2011 at 05:59 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.