As anyone knows from my previous posts I have been giving Ubuntu 10.04 a test drive and so far I am pretty happy with it. I have been spending most of my time configuring the various small things I prefer in Linux. One of those things is I like to have vi as my default editor. Below I will outline a simple way to change your default editor in the shell.
First of all if you are using the default vi that comes on Ubuntu you have probably noticed it has some very odd behavior. I am not certain why this is, however, the fix is very simple so any time I get a fresh Ubuntu install I install the “full” vim package
- sudo apt-get install vim
Once you do that simply type the following into a shell:
- sudo update-alternatives --config editor
You will be presented with the following dialog:
- There are 4 choices for the alternative editor (providing /usr/bin/editor).
- Selection Path Priority Status
- ------------------------------------------------------------
- * 0 /bin/nano 40 auto mode
- 1 /bin/ed -100 manual mode
- 2 /bin/nano 40 manual mode
- 3 /usr/bin/vim.basic 30 manual mode
- 4 /usr/bin/vim.tiny 10 manual mode
- Press enter to keep the current choice[*], or type selection number:
Simply type the number of the editor you want to use and thats all it takes!