Change default editor on Ubuntu

On Windows, when doing stuff like git merge in terminal, my editor is Vim. On Ubuntu default editor is Nano. This is how to change it:



sudo update-alternatives --config editor

Note: entering this command directly in Ubuntu terminal from Windows didn’t work (update-alternatives command not found). I had to open VS Code in WSL2 and enter it via integrated terminal.