vimvim-registers

Paste the content from dot . command in vim


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


Solution

  • The . register and the . command are not the same thing. The . register stores the last text you have inserted and the . command repeats the last non-movement normal-mode command you executed.

    Rather than try to force it to work another way, why not call a different registry and store values in there? The . registry will be overwritten by the last inserted text but many of the other registries are only changed when you actively tell vim to, so you can fill them yourself with the exact keypresses you want and call them again later.

    Type

    :reg
    

    To see a list of what is currently inside each of your registries

    Also have a look at this fantastic resource explaining vim's registers
    https://www.brianstorti.com/vim-registers/