Change default command line editor

Hello.

I want to change the default command line editor from vim to nano, so for example when I type “visudo”, I want it to user nano. In Ubuntu this can be easily done by using “update-alternatives --config editor”, but openUSE doesn’t have an editor-option.

Any solutions?

Just found out that I can specify the editor in /etc/sudoers.

I’m just used to Ubuntu. Sorry, delete this thread please

Nope. It contains information that might help others. Welcome to the forums, and thanks for coming back and replying to your own post.

export EDITOR=nano
in ~/.profile or ~/.bash_profile.

Unfortunately if you read man sudo, it won’t use $VISUAL or $EDITOR unless overridden, as it considers those variables a security risk.

But yes, many other programs will honour $VISUAL and $EDITOR.