Unix administration stuff that was hard to find out using Google and caused a lot of try and error. Hereby given back to the net...
Use a graphical Linux Editor for VCS Commits
Submitted by Lars Windolf on 31. August 2012 - 19:11.
1. Using gedit
If your main editor is the graphical GNOME editor gedit you can also use it when doing version control system commits, crontab edits, visudo and others things on the command line. All you need is to set it to the $EDITOR environment variable.
The only thing you need to be careful about is wether the editor detaches from the terminal right after starting. This must not happen as the calling command (e.g. "git commit -a") would never know when the editing is finished. So for gedit you have to add the "-w" switch to keep it waiting.
export EDITOR="gedit -w"
2. Using Emacs
For XEmacs simply set
With Emacs itself you also have the possibility to use server mode by running emacs-client (see "Starting emacs automatically" in the EmacsWiki). To do so set
export ALTERNATE_EDITOR=emacs EDITOR=emacsclient
3. Using Other Editors
If you use the goold old Nirvana Editor nedit you can simply
the same goes for the KDE editor kate:
and if you want it really hurting try something like this:
export EDITOR=eclipse export VISUAL=oowriter
4. $EDITOR and sudo
When using sudo you need to pass $EDITOR along to the root environment. This can be done by using "sudo -e" e.g.
sudo -e visudo
Wether passing the enviroment to root is a good idea might be a good question though...