I'm aware of the jumps list, and that you can navigate forwards and backwards through locations I've previously jumped between. But I'd like to duplicate the behaviour of many other editors (such as Visual Studio) where essentially they include movements such as page up/down as jumps so that they too can be navigated forwards and backwards. That is, having pressed page down 10 times you can go back ten times. In this example you might just as well press page up, but obviously when you're performing a mixture of jumps, go to declarations, changes etc it's great to be able to go back one step at a time.

It would appear this is not possible in vim, but perhaps I'm missing something. Is it something that can be achieved with a remapping or plugin?


The best solution/workaround I can see is to remap Control-D/U/B/F (and any other operations you want to end up in the jumps list) to additionally goto the current line, which I do by setting a mark and jumping to it. For example:

nnoremap <c-d> <c-d>mp`p
  • 2
    If you just want to go back one step use ctrl-o. – goldilocks Oct 15 '15 at 14:14
  • 1
    I know about ctrl-o because that's how you navigate the jumps list, which is what this question is about. Like I put in the question, it won't work for operations such as page down (which don't alter the jumps list), which is what my answer addresses. – user859 Oct 15 '15 at 14:38

Your Answer

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