Given the word foo in a text, if I type ciwbar<ESC> while recording it as a macro in w register and then type in the command line :<C-r>w it will brings me :ciwbar^[

However if i type :<C-r>. it will only brings me bar

But both commands, the @w and dot, are able to perform the change inner word bar in other parts of my text

Is there any way to get all the content from the dot as I got the w register? I would like to paste it and work to automate the last command in macros in some steps forward

  • You can get the last insertion using @.. But it is only a small part of the power of . – Charles Gueunet Jul 24 '18 at 8:59

As you said yourself there is a difference between a register like @w and . which is a command.

The . command is meant to repeat only simple, unit changes (as the doc says :h .: Simple changes can be repeated with the "." command.).

On the other hand, macros recorded in registers are meant to repeat more complex and longer changes (see help is at :h complex-repeat).

The behavior of the dot command is hard coded and does not use a register or a buffer which can be accessed by the user so there is no way to get what it will do as a vimscript string.

| improve this answer | |

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.