I used many macros assigned to registers, for instance I have this line in my .vimrc:

let @p='^[O</p>^[0jj'

I just type @p and it closes the tag, very convenient.

PROBLEM: On my new keyboard @ (at-mark) is too far away.
QUESTION: Can I change it to another key? ; would be convenient.

  • 1
    May want to consider a different key than ; as ; is rather useful. ; repeats the last t/f. See :h ; Mar 29 '16 at 14:12

Add this to your .vimrc:

:noremap ; @
:noremap @ ;

The first line maps the ; key to the register feature.

The second line maps the @ key to whatever feature was assigned to the ; key, just in case you need it. It is optional.

noremap creates a non-recursive mapping.

Thanks to Carpetsmoker for the tip!


On azerty keyboards @ is on the same key as à but it is less convenient to use since you have to press Alt Gr to get it. As à is not really useful in Vim I used langmap to switch the key only in normal mode (see :h 'langmap').

With this in my .vimrc:

set langmap+=à@

I can use àp to execute the macro in the register p. And the insert mode still works the same.

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.