Sunday, February 20, 2011

Re: mapping F3 to map q ^B

> 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>

--
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: