September 6, 2008 · Server · Email This Post

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

When a program in Ubuntu such as crontab -e or dch -i, is used to edit a file, it uses a helper program called sensible-editor.

sensible-editor attempts to intelligently find an editor on your system based on a few simple rules. Basically, if you haven’t already defined $EDITOR, it will use one of {nano, nano-tiny, vi}, in that order.

Now, it’s well understood that nano is easier to use than vi to a new Ubuntu user. And it’s assumed that if you are sophisticated enough to want a different editor, then you likely already know how to change that setting.

Traditionally, this can be done in one of two ways.

You can edit your ~/.bashrc file to export an EDITOR value of your choosing. Of course, that requires that you have a usable editor with which you can modify that file!

If you are an administrator of the system, you can set the default editor for the entire system:

sudo update-alternatives --config editor

So we have a new utility in ubuntu intrepid, /usr/bin/select-editor, which uses update-alternatives --list to display a list of editors present on the system and prompt the user to select one. The selection is written to ~/.selected_editor.

The default selection remains nano, but for those of us installing dozens of Ubuntu systems every week and looking for a more powerful editor, we now have a really convenient, friendly mechanism for each user on an Ubuntu system to interactively choose an editor preference the first time they need one!

Thanks to Dustin for this package.

  • Share/Save/Bookmark

Related Articles

Leave a Reply