Let's say I've set a mark a via ma. Then 'a will bring me to the first non whitespace character of the line. However `a will bring me to the exact position of the mark a.

I prefer the second behaviour and would like to create a map. So I always get the behaviour of the backtick command.

First attempt:

:map 'a `a
:map 'b `b
... etc

It seems really bad to do this for every possible mark. How would I go about this?


is a sentence: "jump to the line where mark a is".


is also a sentence: "jump to where mark a is".

Since you want "the line where a given mark is" to mean "where the given mark is", mapping all the possible sentences would certainly be wasteful.

Instead, you only need to swap those two elements:

nnoremap ' `

which reads: "the line where a given mark is now means where the given mark is".

  • 1
    Won't this replace ' with ` outside the context of marks as well?
    – user9334
    Sep 19 '16 at 14:43
  • 4
    It will only affect normal mode. Insert mode and command line will be unaffected. This is the difference between nnoremap and noremap. And as far as I know in normal mode ' and ` are pretty much just used for marks.
    – Tumbler41
    Sep 19 '16 at 14:50
  • @Tumbler41 Thank you :) That's what I wanted to hear!
    – user9334
    Sep 19 '16 at 15:11

Your Answer

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