Sunday, February 20, 2011

Re: mapping F3 to map q ^B

Reply to message «Re: mapping F3 to map q ^B»,
sent 12:47:16 20 February 2011, Sunday
by ZyX:

Sorry, you are write: <C-b> is taken as cmdline mode shortcut, not as literal
<C-b>.

Original message:
> Reply to message «Re: mapping F3 to map q ^B»,
> sent 11:08:51 20 February 2011, Sunday
>
> by Ben Schmidt:
> > P.S. You can do the escaping differently using the <> notation, but you
> >
> > still need a 'double escape' kind of thing:
> > :map whatever <Esc>:map q <lt>C-b><Enter>
>
> You don't: ``execute "noremap q \<C-b>"'' works as expected. <> notation is
> for readability (especially if you want to read file using `cat' without
> -v or paste it on some pastebins), it is not required for noremap command
> itself. Having <LT>C-b> is against readability.
>
> Original message:
> > > map #3 ^[:map q ^B^M
> > >
> > > which does not produce any errors, but doesn't work. Pressing F3 causes
> > > vim to display "No mapping found".
> > >
> > > I suspect my problem is that I'm trying to do a mapping with a map
> > > command (something akin to trying to print a double quote inside of a
> > > double-quoted string).
> >
> > Yes, that's pretty much it. In order to make a ^B actually appear on the
> > commandline while you're typing, you need to type ^V before it. So you
> > need
> >
> > map #3 ^[:map q ^V^B^M
> >
> > The right hand side is the list of keys you need to press to get
> >
> > :map q ^B
> >
> > to appear on the commandline. (And of course the ^M confirms it, by
> > 'pressing enter'.)
> >
> > Not sure what you have the ^[ there for; if it's just a normal mode
> > mapping, you shouldn't need to exit any other mode by pressing escape.
> > It may cause a beep/error and abort the mapping, though, so perhaps you
> > should try without that, too.
> >
> > Ben.
> >
> > P.S. You can do the escaping differently using the <> notation, but you
> >
> > still need a 'double escape' kind of thing:
> > :map whatever <Esc>:map q <lt>C-b><Enter>

No comments:

Post a Comment