change default editor in Ubuntu

Just installed Ubuntu, and tried to edit some files, but nano came out?
Not used to nano editor?

Change it to your preferred editor (vim in our case).

$ sudo update-alternatives –config editor
$ sudo update-alternatives –config editor
There are 5 alternatives which provide `editor’. 
Selection Alternative
———————————————–
1 /usr/bin/vim
2 /bin/ed
*+ 3 /bin/nano
4 /usr/bin/vim.basic
5 /usr/bin/vim.tiny
Press enter to keep the default[*], or type selection number: 

 

No comments: