For instance, when i press 'I' to go into insert mode, and then use the arrow keys to move around the line, the left arrow ends up inserting the letter 'D' one line above the line I was intending to edit, the right arrow inserts a 'C' etc. Is this a server configuration thing, an SSH thing, a vim thing or what? Any advice is appreciated, I realize this is not exactly a programming question but I'm not sure where exactly else to file it.

  • You're using vim; why do you need arrow keys? – William Pursell Feb 12 '10 at 5:12
  • because there is no way that I know of to get to the end of the line in VIM without using the arrow keys. You press $ to get to the chartacter before the end of the line, but the way I usually get around this is to get the one character before the end of the line, go into Insert mode, then press right once – Joseph Carrington Feb 12 '10 at 5:17
  • $ moves to end of line, but A appends after end of line. Each of H, J, K, and L move the cursor one line or character. They are the vi arrow keys. – wallyk Feb 12 '10 at 5:40
  • 1
    I like also having the arrow keys available for use in Vim. I use them in so many other applications on so many operating systems, reaching for them is hard-wired into my fingers. – Jonathan Hartley Dec 2 '10 at 12:33

It's a terminal type problem. The window creating the remote connection is not properly giving an understandable terminal type. Or maybe the host doesn't recognize the terminal type and is punting to vt100 or something.

The specific ssh client and platform and the host type are needed for detailed help, but once you have connected and logged in, but before starting vim, type echo $TERM. If it's blank or corrupted, try setting it to xterm and see if vim works better.

| improve this answer | |
  • Both my local $TERM and the $TERM on the remote server are xterm-color. So should I change them to VT525? If so, how do I do so? $TERM = VT525 ? – Joseph Carrington Feb 12 '10 at 5:08
  • Depends on what the client is. xterm-color ought to be well-supported. It could be that the client terminal isn't properly configured for your keyboard. – wallyk Feb 12 '10 at 5:15

Your local terminal and the remote side's $TERM settings don't match. Configure your client for VT110, VT220, or VT525 (the higher the better), then set $TERM on the remote side to the same value.

| improve this answer | |

This page says that manually setting the TERM variable is almost never a good idea, and suggests some alternatives:


Sure enough, for me, just unsetting my TERM variable fixed the problem, plus other problems like terminal colors too.

| improve this answer | |

Add the following line in your home directory's .profile file:

| improve this answer | |

Your Answer

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