Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If you run vi/vim in screen, when you press a cursor in insert mode, you get a new line + a character, which is a pain.

How can I configure vim to move around instead?

share|improve this question
on what platform(s)? I run connections to solaris via screen on my linux boxes, and have never seen this :) – warren Mar 3 '10 at 19:33
ubuntu/debian usually – Tim Abell Mar 4 '10 at 9:40

Put the following in you ~/.exrc file

map! ^[OA ^[ka
map! ^[OB ^[ja
map! ^[OD ^[i
map! ^[OC ^[la

Note: ^[ is the “ctrl-v Esc” key presses. Copy and paste will not work.

share|improve this answer
up vote 2 down vote accepted

Start vi with


instead of


as vim isn't affected by this issue!

share|improve this answer
I assure you vim is definitely affected by this. – ScaryAardvark Apr 13 '12 at 12:40
It could be an ubuntu/debian thing I suppose, maybe the config is different. I'd forgotten about this problem! – Tim Abell Apr 16 '12 at 9:51

Arrow keys are nice, but you should try to get used to using "hjkl" to move around in vi. This always works, so you won't need to worry about changing the config file on every system where you have this problem.

share|improve this answer

Your Answer


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.