I'm loving the fact that I can jump using relative numbers and a movement command but I always seem to find myself using the backticks to try and go back to where I was before the movement jump.

I know that movement isn't added to the jump list and I agree with that if it's just a single movement but if it's a numbered jump (more than one) I feel like it should be added to the jump list. So my question is how do I do this?

  • 2
    What is a "numbered jump"?
    – romainl
    Commented May 1, 2016 at 12:34
  • 4
    – VanLaser
    Commented May 1, 2016 at 12:46
  • 1
    @VanLaser great thanks for that just what I wanted
    – jmjones5
    Commented May 3, 2016 at 20:55
  • You can try '0 to '9. That jumps to the last edited position in the previously edited files.
    – SibiCoder
    Commented May 9, 2016 at 14:16

1 Answer 1


Edit didn't realize someone posted the same answer in a comment rather than just posting an answer.

Per a post on /r/vim, you can add numbered jumps by setting the previous context mark. These two lines will only set the mark when jumping more than 1 time (i.e. must be numbered like 3k or 20j)

nnoremap <expr> k (v:count > 1 ? "m'" . v:count : '') . 'k'
nnoremap <expr> j (v:count > 1 ? "m'" . v:count : '') . 'j'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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