just wanted to update this thread as the above solution didn’t work for me and I had to add some more steps.
root@osmc:~# sudo update-alternatives --config editor
There is only one alternative in link group editor (providing /usr/bin/editor): /bin/nano
Nothing to configure.
Following command added vi into alternatives with priority 50:
sudo update-alternatives --install /usr/bin/editor editor /usr/bin/vi 50
Then I could choose what editor to use or kept automatic for the editor with highest priority:
root@osmc:~# sudo update-alternatives --config editor
There are 2 choices for the alternative editor (providing /usr/bin/editor).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/vi 50 auto mode
1 /bin/nano 40 manual mode
2 /usr/bin/vi 50 manual mode
Press <enter> to keep the current choice[*], or type selection number: 0
then exporting EDITOR variable and adding to your .profile (in your home directory) would be also good just to preserve the setting.
export EDITOR=vi
cd ~
vi .profile
add
export EDITOR=vi
at the end of the file and save the changes.