2

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.

John
  • 7,153
  • 22
  • 61
  • 86

3 Answers3

3

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?

Kyle Brandt
  • 82,107
  • 71
  • 302
  • 444
3

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

Rik Schneider
  • 2,419
  • 14
  • 19
  • 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
0

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