Re: Help me understand @. macros
- On Sun, 26 Aug 2012, Andy Wokula wrote:
> Am 20.08.2012 22:58, schrieb cybrown:Pretty good explanation. Two nits:
>> 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:
>> Here's the shortest solution posted:
>> First off, I didn't realize @. was a valid macro combination. So, my
>> 1) Is @. any different than .? Why would I want to use one instead of the
>> 2) What's going on with this solution? Why does it work but:
>> doesn't work? What's so special about inserting the dot specifically?
> All in all, it's a tricky one; in order to congrat the author I'll
> give a lengthy explanation :-)
> He implicitly records into the `.' register by typing `.' in Insert modeHe implicitly records into the ". register because he's inserting text
> ("recording" is later stopped with `<Esc>');
with `a'. The ". register "Contains the last inserted text" according
You can record into ". via i, I, a, A, o, O, and <Insert> (possibly
others -- those are the ones I could find quickly).
> the dot is not wanted for the line break, so he also hits `<BS>'.`<BS><CR>' is <BS> (equivalent to `h', except that 'whichwrap' contains
> `@.' is executed in Normal mode where the sequence `.<BS><CR>' gets a
> different meaning.
> For this special case, `<BS><CR>' is a no-op, so `24@.' executes `.' 24 times
> in a row, with the intended result.
'b,s' by default, so <BS> wraps over line breaks) followed by <CR>
(equivalent to `+'). So <BS><CR> moves up a line (because we're on the
first character of the line and it wraps) and down a line. So it's only
a "no-op" because it's not performed on the first line of the file
(where it would move down by one).
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