Change Default Terminal Editor

export EDITOR=nano

OR

echo export EDITOR=nano >> /etc/profile

OR

EDITOR=nano

Don’t foreget to source ~/.bash_profile or exec bash for the change to take effect.

Source