Friday, June 20, 2008

Changing the default editor in ubuntu

Ubuntu comes with a number of defaults that may or may not be to your liking. For example, the default editor is set to Nano, which isn't optimal if you're used to Vim.

The easy way to change this is to use the update-alternatives program, which maintains the symbolic links under /etc/alternatives that determine the default programs for FTP, system editor, rsh, Telnet, window manager, and so forth. Look under the /etc/alternatives directory to see what programs are managed.

To change the default editor, run sudo update-alternatives --config editor. You'll see a dialog like this:

There are 3 alternatives which provide `editor'.

Selection Alternative
-----------------------------------------------
1 /usr/bin/vim
2 /bin/ed
*+ 3 /bin/nano

Press enter to keep the default[*], or type selection number:

Just type 1 to switch to Vim. Note that on my system, I don't have Emacs or many other editors installed; if I did, the utility

No comments:

Post a Comment