By Default Debian Etch Provides the nano editor you need to follow this procedure.In this example i want to use vi editor as my default editor
Administrators who wish to change the default editor for all users will have to update the alternatives system using:
# update-alternatives --config editor
Once you enter it opens available editor options from your server you should see similar to the following screen here i have selected option4 for vi editor
If you are an user wishing to change the default editor can define the environment variable EDITOR by introducing the following lines in their own profiles
EDITOR=vi
export EDITOR
alias editor=$EDITOR
The profile advice does not appear to work in either Etch or Ubuntu; I have .bash_profile containing the EDITOR=vim.tiny;export and alias lines as above, I even created a ~/bin/editor symlink! But I still get nano 🙁
I had the same problem I put ” export EDITOR= ” in .bashrc
Thnks for the Solution…
Thank you for your help, but I think that I make the same mistak than other people in comment. Changing EDITOR will not solve 100% the problem. Debian based solution (debian, ubuntu, …) use the “alternatives” to create base aliases. If you update the EDITOR, this will update the value for something called the “editor”. If you try to type :>vi myfile.txt and it’s not the VIM Editor… it because you don’t update the vi alias also. You need to do that also:
update-alternatives –config vi
Every “alternatives” aliases are located in /etc/alternatives. update-alternatives –config editor will solve the problem if you was typing :>editor myfile.txt
Then you need to these commands for full vi support:
update-alternatives –config editor
update-alternatives –config vi
update-alternatives –config view
…
You need to export VISUAL to set the editor for user, not EDITOR.
export VISUAL=vim works
Excellent solution, thank you!