Monday, August 20, 2012

Re: Help me understand @. macros

On Aug 20, 1:58 pm, cybrown <cybr...@gmail.com> wrote:
> I'm a relatively new VIM user, and I've been playing vimgolf (www.vimgolf.com) to learn new skills. This challenge has a bizarre solution that I don't understand:http://www.vimgolf.com/challenges/4d1db1b8de2f897c2a00014a
>
> Here's the shortest solution posted:
> a.<BS><CR><Esc>24@.ZZ
>
> First off, I didn't realize @. was a valid macro combination. So, my questions:
> 1) Is @. any different than .? Why would I want to use one instead of the other?
> 2) What's going on with this solution? Why does it work but:
> a<CR><Esc>24@.ZZ
> doesn't work? What's so special about inserting the dot specifically?

It is not a macro.
It is executing the CONTENTS of the dot register 24 times.

:help @

@{0-9a-z".=*}
Execute the contents of register {0-9a-z".=*} [count] times.
Note that register '%' (name of the current

:help ".

5. Read-only registers ":, "., "% and "#

*quote_.* *quote.* *E29*
". Contains the last inserted text (the same as what is inserted
with the insert mode commands CTRL-A and CTRL-@). Note: this
doesn't work with CTRL-R on the command-line. It works a bit
differently, like inserting the text instead of putting it
('textwidth' and other options affect what is inserted).

Bill

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: