On Sat, Feb 05, 2011 at 07:57:00PM +0300, ZyX wrote:
> Reply to message «Re: ctrl-o with a mapping», 
> sent 19:38:30 05 February 2011, Saturday
> by Ben Fritz:
> 
> Perhaps a bug somewhere? It should be redirected to vim_dev, I think.
> 
> Original message:
> > On Feb 5, 4:05 am, ZyX <[email protected]> wrote:
> > > Reply to message «Re: ctrl-o with a mapping»,
> > > sent 23:56:30 05 February 2011, Saturday
> > > 
> > > by AK:
> > > > Well, this is a normal mode mapping (nnoremap), by definition all of
> > > > its contents should run under normal mode or not at all.
> > > 
> > > The fact that it is normal mode mapping means that {lhs} will be replaced
> > > by {rhs} if you type {lhs} in normal mode. It never meant that it should
> > > run under normal mode, the fact that first command is run under normal
> > > mode is just a consequence of the fact that you press {lhs} in normal
> > > mode.
> > 
> > It seems strange to me that recorded macros behave differently from
> > normal mode mappings, especially if you interpret them as above. :help
> > @ even says "the register is executed like a mapping".

Hmm, that was a very recent addition to the help and the behavior
doesn't agree with that.  I wonder what the impetus was behind the
addition of that description.

> > For example:
> > 
> > qa0:echo getfontname()<Enter>q
> > i<C-O>@a
> > 
> > This does not insert the :echo getfontname(), it does exactly as is
> > done in normal mode.

This makes sense.  <C-o> lets you execute one normal mode command.  In
this case that command is @a.

> > However,
> > 
> > :nnoremap <F9> 0:echo getfontname()<CR>
> > 
> > i<C-O><F9>
> > 
> > This inserts the :echo command in the text.

And in this case the one normal mode command is 0, since mappings are
treated just like a user typing.

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[email protected]>

Attachment: signature.asc
Description: Digital signature

Raspunde prin e-mail lui