

usr/local/bin/edit (or ~/bin/edit) sudo= # empty is false, non-empty is trueĮditor=nano # XXX check $EDITOR and $VISUAL It checks if you can edit the file, and if you can't, it runs "nano" as root instead. ( UPDATE: Apparently nano 2.2 does warn 2.0 doesn't.) I just tried nano, and what I found most surprising is it doesn't even warn you that the file is read-only when you start trying to edit the file. Nano does not have the ability to launch a new process or pass data to other processes, so it's left out of this party. See for example this related question for other solutions in advanced editors that allow writing the file buffer to a process pipe. ¹ Some editors are actually able to do this by launching a new process with different permissions and passing the data off to that process for saving.

Vim has two modes and they are command mode and insert mode.

You need to select the editor from here or you can just press enter to keep the current setting. To make it default, you need to bring the vim.basic to the first position and that is “0”. You will see the put something like below from where you can change the default editor in Ubuntu. If you want to change the default editor in Ubuntu then you need to edit the config file with the following command: sudo update-alternatives -config editor Nano is the default text editor in Ubuntu which means the files will get opened in Nano.

Sudo apt install vim How To Make Vim the default editor in Ubuntu
