To change the default editor at the system level:
sudo update-alternatives --config editor
and then follow the onscreen prompts.
If your editor isn’t on the list, do this first:
update-alternatives --install /usr/bin/editor editor /usr/bin/vim 10
A little bit of wisdom