On Tue, Apr 7, 2009 at 9:35 AM, fREW Schmidt <[email protected]> wrote:
> > >> >> Maybe this will give some insight: doing @; gives errors about
>> an
>> > >> >> invalid register ';' but doing @: is (apparently) a no-op.
>> > >> >
>> > >> > Sounds like a bug. : should be a register too. If it
>> > interprets @; as
>> > >> > the ; register, then it should interpret @: as the : register.
>> > >> >
>> > >> > --Ken
>> > >> >
>> > >> >
>> > >> Under ":help quote:" it is expicitly said that @: should repeat
>> the
>> > >> latest ex-command.
>> > >>
>> > >> You can also use any of
>> > >> ":p
>> > >> ":P
>> > >> :put:
>> > >> :reg:
>> > >>
>> > >> to see what is there. Of course, if it were empty it would be a
>> > no-op.
>> > >> But here, even after using : as the ex-command the register
>> doesn't
>> > >> become empty, and since it's a read-only register you couldn't
>> do
>> > >> :let @: = ""
>> > >
>> > >
>> > > That's still a bug though, right? @: doesn't execute the latest
>> > > ex-command. And @; should map to @: but doesn't...
>> >
>> > One of the two following cases should be true:
>> > Case 1: @: maps to @;
>> > @; maps to @:
>> > Case 2: @: maps to @:
>> > @; maps to @;
>> > Case 2 really should be the case. (You're suggesting that case 1
>> should
>> > be the case, and I disagree with that.)
>> >
>> > In my testing, it appears that @; is complaining about the invalid ;
>> > register (like Case 2) and when I type @:, it beeps at me rather
>> than
>> > executing the command. If I type ":p, it pastes the last command
>> just
>> > fine (without a leading : or ;). So something's special-casing the
>> @:
>> > code, and the mappings are messing it up. That's what sounds like a
>> bug.
>> >
>> >
>> > Well, does anyone have any ideas for a workaround? I was thinking an
>> > autocommand that would copy ';' + @: + '<cr>' to @z or something. Then
>> > I could still use it, just with a different register.
>>
>> Hm, what happens if you use one of the following {rhs}es in a
>> Normal-mode mapping? Then you wouldn't need to copy the ex-command
>> register contents except when you really need it.
>>
>> :exe @:<CR>
>> or
>> :let @@ = @: <Bar> exe @@<CR>
>> or
>> :let @@ = @: <Bar> normal @"<CR>
>>
>> Notes:
>> 1. I'm clobbering the unnamed register as the one least likely to hold
>> "valuable permanent data".
>> 2. The above is for use in a mapping. To try it directly at the
>> command-line, use | instead of <Bar> and hit the Enter key (to execute
>> the ex-command) instead of <CR>.
>>
>
> This is close! The first choice works once:
>
> :let @@ = @: <Bar> exe @@<CR>
>
> But then of course @: has changed so I have to do exe @@. I can live with
> that for now, but I'd still prefer that the @@ actually included a ; and a
> <CR> so that I can just do @@ instead of ;exe @@<CR>. Of course I'll do it
> with a mapping, but hopefully I won't have to do that forever and I'd like
> to do this the real vim way.
>
> Thanks again for your help Tony! I'll make mappings now.
>
Ah, and in a *mapping* it doesn't only work once. Excellent!
--
fREW Schmidt
http://blog.afoolishmanifesto.com
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---