In vim, how to make the left and right arrow keys change line

vim

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?

Best Answer

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.

Related Question