Super User is a question and answer site for computer enthusiasts and power users. 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

In vim, my arrow keys work correctly, moving up, down, left, and right as expected, with one exception. At the beginning of a line, left arrow does nothing, instead of going to the last character of the previous line. At the end of a line, right arrow does nothing, instead of going to the first character of the next line.

Is there a setting I can change to get the behavior I expect?

share|improve this question
I would think that most VIM users would recommend that you don't use the arrow keys. – user12612 Jul 23 '10 at 18:45
up vote 12 down vote accepted

After some further Googling, I found the answer is to use the whichwrap option.

I added the following line to my .vimrc:

set whichwrap+=<,>,[,]

The < and > options turn on the desired setting for normal mode and [ and ] turn on the desired setting for insert mode.

share|improve this answer
(Why this was not the default setting on my system is a mystery) – nohat Oct 5 '09 at 8:39
This doesn't seem to affect the behavior of h j k l keys. – Sebastián Grignoli Sep 6 '11 at 17:51

Add this to your .vimrc:

set whichwrap+=<,>,h,l,[,]
share|improve this answer

This is default behavior - you can always use Home and End to jump to the start and finish of a line however.

share|improve this answer
OP wants to change default behavior. Thats why (s)he asked here in the first place. – akira Feb 9 '11 at 8:08

You can work around this by using w and b which will wrap across lines.

share|improve this answer
But b takes you the first character of the last word of the previous line. Is there really no way to make left-arrow move to the last character of the previous line when at the first character of a line? – nohat Sep 4 '09 at 0:27
Yeah I know, It's not a real solution. – hasen Sep 4 '09 at 0:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .