Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I installed Ubuntu and I tried to use the terminal's vi editor. The editor is using a different set of short cut keys that I'm not familiar with. Someone told me it's probably using the VIM short cut keys.

How do I make it use the normal vi short cut keys? For example, I want

i - insert :q - quit

etc...

How do I tell vi to use this set of commands instead of vim?

Another problem: For example, when I hit "back space", I expect vi to Delete, instead of just move the cursor back. When I hit the arrow keys, random letters show up. There are other really quirky things like this that i'm not use to because I've been using the "normal" vi editor.

share|improve this question
    
What is the command you are typing? –  Kyle Brandt Jul 29 '09 at 18:26

3 Answers 3

up vote 3 down vote accepted

You may be using a different clone or a cut down version of vim. Ubuntu by default uses vim-tiny if I remember correctly. You can find out which one is being used by checking the link "/etc/alternatives/vi"**. If it points to /usr/bin/vim.tiny you have a very minimal vim installed. If it points to some other file you can use "dpkg -S filename" to figure out where it came from.

To install a different "clone" use apt-get or another package management tool. I suspect that vim-gnome or vim-full may more to your liking. If one or both of the above are already installed but you have the link

** Many utilities and programs like mail, vi, java, awk, etc. are linked through /etc/alternitives/. For example on my system /usr/bin/cc is a link to /etc/alternatives/cc which is a link to /usr/bin/gcc. This allows a common set of tool names to be used with different packages that provide the same functionality.

I hope this helps

share|improve this answer
    
perfect, i did a sudo apt-get install vim-full –  John Jul 29 '09 at 20:18
    
that might have accidentally fixed the problem (perhaps by overwriting a messed up /etc/vim/vimrc), but vim-tiny and vim-full both use the same key bindings - they ARE both vi clones after all...the differences in the two packages are not in how they work, but in how many vim enhancements have been compiled in to /usr/bin/vi –  cas Jul 29 '09 at 21:58
    
Actually the vimrc file used by vim.tiny contains 2 commands. The first sets where libraries are. The second sets compatible. the other vim packages use a different /etc/vim/vimrc file set that call addtional files under /usr/share/. My mention of using vim-full is based on my experience of vim-tiny not always playing well with differing terminals for X11. It is possible to configure vim.tiny to work with more terminals but the vim-full meta-package has the configuration already there. –  Rik Schneider Jul 29 '09 at 22:44

Update:

From what you said about the backspace and the arrow keys, that sounds like it could be the terminal, not the editor. So your editor is not getting the right keys. Are using a particular xterm? are you on the same machine? Are you using screen?


Vi and VIM should have the same shortcuts. Are you sure you are not using an Emacs editor like nano ( the ubuntu default). That would have shortcuts like ctrl-x to exit.

What does 'echo $EDITOR' from the shell tell you?

share|improve this answer
    
it prints an empty line –  John Jul 29 '09 at 18:18
    
I'm not sure, i just isntalled ubuntu for the first time. I'm a new linux user. From Gnome, i go to Applications>Terminal. Then in terminal, i type vi to start up the editor. –  John Jul 29 '09 at 18:58
    
Rik sounds like his answer is more on the right track to me ... –  Kyle Brandt Jul 29 '09 at 19:51

vim uses the same shortcuts... i is insert and :q is quit, is setting set nocompatible in .vimrc going to help?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.