When I opened
visudo file in Linux it opened in default editor i.e joe. So by running only one command I will change the default editor in Linux.
sudo update-alternatives --config editor
The output of the above command will show all the editors presents in your system and you will select only one editor as default.