VMware Communities
resting
Contributor
Contributor
Jump to solution

VIM insert mode problem with Ubuntu 14.04.1

VIM insert mode doesn't work properly with Ubuntu 14.04.1 VM via SSH.

For example left arrow key causes current line to be pushed down, and a character D inserted instead.

Shortcut like ci" doesn't work as well.

Anyone having this problem too?

Most likely a VMFusion problem since I don't have this problem with my VPN.

Using iTerm2 and VMFusion 6.0.4.

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal
Jump to solution

resting wrote:

2) The command I use is vi, but it's really just vim in ubuntu.

You might also try this (from solution 9):

sudo apt-get install vim

View solution in original post

0 Kudos
12 Replies
resting
Contributor
Contributor
Jump to solution

Thanks for the link. I tried, but it still doesn't work.

Problem might be due to VM cause I don't have problems with using VIM in iTerm2 on my local machine, or VPN via SSH.

Its only when I SSH to the VM that causes VIM to break.

0 Kudos
admin
Immortal
Immortal
Jump to solution

0 Kudos
dariusd
VMware Employee
VMware Employee
Jump to solution

I see this problem in all sorts of situations (including ones that don't involve a VM).  I am not enough of an expert on terminal types to understand exactly what's going on, but I usually work around it by installing the "vim-nox" package.  Somehow the "fuller" vim packages are more capable of dealing with whatever is being sent.  Like I said, I don't pretend to understand why, and it feels like a lame solution, but it usually Works For Me (TM) and is easy enough to do.

Cheers,

--

Darius

0 Kudos
admin
Immortal
Immortal
Jump to solution

Some points from the last link to check:

1) Does your account in the VM have a ~/.vimrc?

2) Are you invoking vim as vim rather than vi?

0 Kudos
resting
Contributor
Contributor
Jump to solution

1) Nope there's no ~/.vimrc

2) The command I use is vi, but it's really just vim in ubuntu.

I might be slow to respond or test out all the solutions here, as I think I can still live by using command mode to navigate around.

0 Kudos
admin
Immortal
Immortal
Jump to solution

resting wrote:

1) Nope there's no ~/.vimrc

2) The command I use is vi, but it's really just vim in ubuntu.

In that case, see solution 5 in the most recent link I posted.  I think that you will find that this behavior is intentional.

0 Kudos
admin
Immortal
Immortal
Jump to solution

resting wrote:

2) The command I use is vi, but it's really just vim in ubuntu.

You might also try this (from solution 9):

sudo apt-get install vim

0 Kudos
admin
Immortal
Immortal
Jump to solution

I have replicated your problem with a fresh Ubuntu installation, and I have confirmed that the following fixes it:

sudo apt-get install vim

0 Kudos
admin
Immortal
Immortal
Jump to solution

I believe I have now found the optimal solution.

Edit /etc/vim/vimrc.tiny in the Ubuntu VM.  Change the line that says:

set compatible

to

set nocompatible

That did the trick for me.

resting
Contributor
Contributor
Jump to solution

Thanks again so much for helping.

This really solved the trouble of the work around I'd been doing.

So it really turns out that I had to do a apt-get install vim to fix all those weird behaviors.

Changing /etc/vim/vimrc.tiny to set nocompatible helped fix the arrow keys but didn't fix the backspace keys and some commands like ci" or caw.

But apt-get instal vim seems to fix everything I used.

0 Kudos
vinbolisetti
Contributor
Contributor
Jump to solution

this worked for me on my new ubuntu installation in vmware.

0 Kudos