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?

link|improve this question
3  
I would think that most VIM users would recommend that you don't use the arrow keys. – user12612 Jul 23 '10 at 18:45
feedback

3 Answers

up vote 9 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.

link|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
feedback

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

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

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

link|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 j Sep 4 '09 at 0:44
feedback

Your Answer

 
or
required, but never shown

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