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.

3 Answers 3


To move to the beginning of the next line, hit Enter. See :help <CR>.

To make right and l wrap to the beginning of the next line, add > and l to the 'whichwrap' option, e.g.,

:set whichwrap+=>,l

Similarly, to make left and h wrap to the end of the previous line, add < and h to the 'whichwrap' option, e.g.,

:set whichwrap+=<,h

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 or 0left would work, and you could possibly map either of those to some key you don't often use.

  • Pressing enter goes to the beginning of the next line, not the end. (Which is what the OP wanted, but your answer reversed the terminology.)
    – Heptite
    Jun 1, 2012 at 0:15
  • @Heptite: That's what I meant. Bad fingers! Thank you for catching that. Fixed.
    – garyjohn
    Jun 1, 2012 at 0:31
  • 3
    Thank you! Also I just figured out that to get this to work in insert mode, you can do set whichwrap+=[,]. Jun 1, 2012 at 0:50

For your first question, I am not aware of any shortcut that will do what you want, but you could map it. For example:

:nnoremap <c-p> k$
:nnoremap <c-n> j0

For your second question, look at ":help 'whichwrap'" (with the single quotes as part of the command).


+/- let you move up and down on the start of every line. $ will go to the end of line, and you'll stick there with k/j.

  • 3
    The OP knows about $ (and ^) and said that he does not want to use them. Feb 20, 2020 at 21:01
  • 1
    good point, -/+ still stands though
    – DZet
    Feb 21, 2020 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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