Changing the Default Text Editor in Linux
A default text editor comes with several Linux distributions. Like nano, vim, ed etc. Users will change it according with their preferences by ever-changing the $EDITOR atmosphere variable.
Below is the explaination for for changing default editor from nano to vim.
Then open the .bashrc file and add the line as shown below.
#FILE: .bashrc
export EDITOR=”vim”
Different instruction applications alike the crontab, svn and visudo make use of the $EDITOR variable to decide on the default text editor.
How to change default text editor in Ubuntu
In an operating system like Ubuntu, you would need to use a script inorder to vary the default text editor called the update-alternatives. Below is that the description of howr you’ll be able to approach doing it.
Now in your terminal, enter the below command :
$ sudo update-alternatives –config editor
You may also do that by work in as root to avoid using sudo to run the command. You then be prompted for password, getting into the right password you’d be presented with a list of console text editors found on your system. You will be able to select between them and change it to using as a default text editor.
[sudo] password for yourserver : *****
There are 3 alternatives which provide `editor’.
Selection Alternative
1 /usr/bin/vim.tiny
2 /bin/ed
*+ 3 /bin/nano
Press enter to keep the default[*], or type selection number: 1
Additionally, you are able to change the default text editor and apply it all across the system (for all users) or select to change it for a particular user. Below is the step for the same :
A. System Wide
Run the following command and choose the one of your choice
$ sudo update-alternatives –config editor
B. User Level
A server admin who only wishes to change the text editor for particular users or, If you are a user with limited privileges, you can add an alias for editor to for example vim.
For these, you must Open and edit ~/.bashrc with adding alias editor=vim
You can test it now. Once you open a bash prompt, you’ll see that the editor has changed according to your preference that you have selected.
If you need any help with this, please feel free to contact our technical support department via. online chat available at our website OR raise a ticket stating your requirements with the preferred text editor.