Let's say I have the following text which I highlight:

s/ /","/g

And then I yank it into the a register:


How do I then run those commands? I thought doing @a would execute those commands, but it seems to just 'paste' in the text of the command. How would this be done?

  • 1
    Should we explain the difference between Normal mode and Command-line mode again?
    – Matt
    Jun 14, 2020 at 6:07
  • @Matt -- I had forgotten to add the : at the start of the command, and then it worked when yanking it.
    – David542
    Jun 14, 2020 at 6:36

1 Answer 1


The normal mode command @a will execute the contents of register "a in normal mode, as if they were a mapping.

To instead execute the contents of "a as an ex command, use the ex command, :@a.

See :help :@ for more details, and note that, in versions of Vim prior to 8.2.0997, line continuations in the register will not work when executing code in this way.


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.