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?

  • 4
    I would think that most VIM users would recommend that you don't use the arrow keys.
    – user12612
    Jul 23, 2010 at 18:45
  • 1
    @user12612 why exactly?
    – luchonacho
    Sep 30, 2017 at 19:08
  • @luchonacho I think the idea is that serious VIM users would hold that your fingers should not leave the home row of your keyboard in order navigate where you are in your text.
    – nohat
    Oct 2, 2017 at 20:32

4 Answers 4


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.

  • 4
    (Why this was not the default setting on my system is a mystery)
    – nohat
    Oct 5, 2009 at 8:39
  • This doesn't seem to affect the behavior of h j k l keys. Sep 6, 2011 at 17:51
  • Right, there are other values for h and j. See :help 'whichwrap' or vimhelp.appspot.com/options.txt.html#%27whichwrap%27 . k and l don't really apply since we're talking about left/right behavior at the beginning/end of lines. Jul 28, 2017 at 14:34

Add this to your .vimrc:

set whichwrap+=<,>,h,l,[,]

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

  • 9
    OP wants to change default behavior. Thats why (s)he asked here in the first place.
    – akira
    Feb 9, 2011 at 8:08

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

  • 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, 2009 at 0:27
  • Yeah I know, It's not a real solution.
    – hasen
    Sep 4, 2009 at 0:44

You must log in to answer this question.

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