LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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

Reply
 
Search this Thread
Old 03-28-2011, 05:07 PM   #1
nokangaroo
Member
 
Registered: Nov 2009
Posts: 140

Rep: Reputation: 23
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.
 
Old 03-28-2011, 05:11 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,648
Blog Entries: 2

Rep: Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095
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.
 
Old 03-28-2011, 06:45 PM   #3
nokangaroo
Member
 
Registered: Nov 2009
Posts: 140

Original Poster
Rep: Reputation: 23
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.
 
Old 03-28-2011, 06:48 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,648
Blog Entries: 2

Rep: Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095
Just for clarification: Since nano is a command-line program you have to start it in a terminal.
 
Old 03-28-2011, 06:54 PM   #5
nokangaroo
Member
 
Registered: Nov 2009
Posts: 140

Original Poster
Rep: Reputation: 23
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 06:59 PM.
 
  


Reply

Tags
debian, editor, ubuntu


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change the default crontab editor kawatom Red Hat 5 03-06-2011 02:07 PM
how to change default editor graziano1968 Linux - Server 3 12-19-2007 09:43 PM
Is it possible to change the default text editor? Gethyn Slackware 2 09-05-2006 06:08 PM
how to change default SUDO editor??? orgee Linux - Software 3 10-12-2004 08:39 PM
how can I change the default editor (vipw, crontab -e) or pager? Xavius Linux - Newbie 1 04-05-2004 02:45 PM


All times are GMT -5. The time now is 08:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration