How to set editor used by sudoedit

sudoedit is the recommended command to use to edit files owned by the superuser. On many systems, it uses the nano editor to open these files. You might prefer to use a different editor like Vim to edit these files.

The man page for sudoedit says that the editor used is decided based on the environment variables EDITOR, SUDO_EDITOR or VISUAL. Setting these variables proved to be useless, since it did not affect the editor used by sudoedit.

The method that works is to run sudo update-alternatives --config editor and choose your preferred editor from the list that is displayed. It works and sudoedit starts using the editor you picked.

Tried with: Raspbian 7

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s