5

I realize a difference in vi editor of ReD Hat and Ubuntu. In my company, I'm working in Red Hat. In that, the vi editing commands working as usual. Say, 'dd' to delete,'p' to paste, 'yy' to yank, etc. But in Ubuntu, if I open the vi editor in terminal, then the commands are not working properly.

Even to switch vi to Insert mode, I am supposed to press 'I' many times. I can type coding after some struggle. I can't delete a letter by pressing 'Delete' button. If I press 'Up', 'Down','Left', 'Right' keys, then some alphabets are being written in it.

Why this is happening? How to resolve it? Is this because of Ubuntu?

migrated from stackoverflow.com Nov 23 '11 at 10:51

This question came from our site for professional and enthusiast programmers.

  • 1
    Probably, different versions or, most likely, on the one place, vi is really vi, on the other - vi is alias for 'vim'. – Kiril Kirov Nov 23 '11 at 10:22
  • 5
    Nope. I suspect unset TERM variable (or wrong value). is this perhaps over ssh/screen? – sehe Nov 23 '11 at 10:28
3

Ubuntu comes with vim-tiny, which IMHO sucks.

you need to install vim

do

sudo apt-get install vim

  • That doesn't explain the differences that Dinesh is seeing. Those basic commands work in vim-tiny as well as in the larger versions. – garyjohn Nov 23 '11 at 16:48
  • ubuntu's vi defaults to vi(original) compatibility mode. which behaves like this . To disable it in vi(default) in ubuntu: :set nocompatible. refer bug reported. – Sachin Divekar Nov 23 '11 at 17:12
1

I got rid of the arrows not working by adding the .vimrc file in my home directory. I found the answer here, under "Additional solution 5". All I have in the file is "set nocompatible", as mentioned above.

However, I highly recommend you installing the full version of vim as Mr. Divekar mentions above.

0

It isn't necessary to install vim, or any other flavor of vim to fix the problem. Just change a setting:

sh -c 'echo "set nocompatible" >> ~/.vimrc'

That's all.

If this does not resolve it, and the problem is that it is happening over ssh, then when you are in vim or vi, do this command first of all: :set term=cons25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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