5

In Normal and Visual modes you can execute a motion or other operation using the contents of a register with @. This @ key does not work however in Operator-pending mode. Is there another way to use a motion from a register with an operator?

In Operator-pending mode it is still possible to use commands as motions, for example: :call <SID>MyAction()<CR>. What would be the reason for not allowing registers?

6

The technical reason is that the @ command isn't defined in operator pending mode. Why? Probably because it wasn't in vi, and because it only makes sense when the register actually contains a motion.

You can work around this via :normal, though, e.g. qq3eqgU:normal! @q<CR>.

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.