Monday, January 12, 2009

Remap Backtick

I find it convenient to remap the backtick key "`" to single-quote "'". Functionally, they are very similar. Backtick takes you to an exact mark location while single-quote simply takes you to the beginning of the marked line. I don't use the single-quote functionality much, and it's much easier to reach than backtick, so the following mapping saves some finger stretching.

nnoremap ' `
nnoremap ` '

7 comments:

Anonymous said...

That's a really good idea. For some reason, it does not work for me though. (Yes, I've restarted vim).

Casey

noid said...

What a great tip! Thanks!

Casey: I was a bit tired when I tried this tip and missed the space between ` and ' at first. Make sure you haven't made the same mistake :)

Anonymous said...

Thanks noid, that was the mistake I made. Works great now.

Casey

Anonymous said...

How about a share-your-.vimrc thread? That might generate some useful tips.

Travis Whitton said...

That's a nice idea. I'll put my vimrc online soon.

Anonymous said...

Similarly, if you set preference nostartofline, movement commands like Ctrl-F, gg, etc., will try to retain the same column after the move, rather than moving the cursor to the beginning of the line.

Anonymous said...

In my version, 7.2.77, the help says that backtick (`) and single quote (') are the same.
So no need to map.
Thats good for non-us keyboards (it was need to type four backticks to jump to the mark)