Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
4  
I would think that most VIM users would recommend that you don't use the arrow keys. –  user12612 Jul 23 '10 at 18:45
add comment

4 Answers

up vote 11 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 comment

Add this to your .vimrc:

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

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
3  
OP wants to change default behavior. Thats why (s)he asked here in the first place. –  akira Feb 9 '11 at 8:08
add comment

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. –  hasenj Sep 4 '09 at 0:44
add comment

Your Answer

 
discard

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.