View Single Post
  #9 (permalink)  
Old 10-14-2010, 05:23 AM
stoggy stoggy is offline
Starter Member
 
Posts: 1
Default

you can export a setting to get your favorite editor in visudo. This will replace vi for every program that requires an editor too, well the ones that use the EDITOR environment setting. Typically any that start from the cmdline.

export EDITOR=nano # replace nano with whatever.

i suppose you could even use something like kwrite but i haven't tried that. I would be fearful of being in a situation where the gui wouldn't start and not being able to edit something. You could just re-export EDITOR in such a situation and you could easily switch to a console editor but i use vi in the gui so I don't really have a reason to.

If you take the time to learn vi, i hated it at first, it is worth it. Now i cant stand anything but vi. Its just faster and easier to do things.


You sound pretty new to linux, so here you test it. I don't have kwrite installed.

open a command line.

type this:

echo $EDITOR # this is your current editor setting. So you can switch back if you need to.
export EDITOR=kwrite # this will set your editor to kwrite, make sure you are in the gui when you try, it WONT work in just the command line.
sudo visudo # this is the test, if works then just set the export EDITOR in your .bashrc or .bash_profile. now its saved for the next time you login

if it doesn't work
export EDITOR="what it was before" # now your back to the way it was if kwrite doesn't work.


You could make aliases to set these too. You would put these in your .bashrc or .bash_profile and then you could easily switch back and forth. You would still need to set a default.
export EDITOR=kwrite
alias SWITCH-EDITOR-GUI='export EDITOR=kwrite' # then just type SWITCH-EDITOR-GUI and editor will be set to GUI
alias SWITCH-EDITOR-CUI='export EDITOR=vi' # then just type SWITCH-EDITOR-CUI and editor will be set to CUI

Last edited by stoggy; 10-14-2010 at 05:35 AM..
Reply With Quote