Is there any shortcut in vim to move to the beginning of the next line or the end of the previous line? Is there any way to do it without having to use $
or ^
?
Also, is there any way to make it so that if I hit right
or l
at the end of a line, it moves to the beginning of the next line? Similarly for left
or h
at the beginning of a line to move to the end of the preceding line? I'm using MacVim if that makes any difference.
Best Answer
To move to the beginning of the next line, hit
Enter
. See:help <CR>
.To make
right
andl
wrap to the beginning of the next line, add>
andl
to the 'whichwrap' option, e.g.,Similarly, to make
left
andh
wrap to the end of the previous line, add<
andh
to the 'whichwrap' option, e.g.,See
:help 'whichwrap'
.I don't know of a single-key shortcut to move to the end of the previous line, but with those 'whichwrap' settings,
0h
or0left
would work, and you could possibly map either of those to some key you don't often use.