On 8/16/06, Meino Christian Cramer <[EMAIL PROTECTED]> wrote:
Hi,

 now, as I becom a fan of $gp I treid to write a key shortcut for
 this.

 I checked with

         help M-p^D

 whether this keysequence is occupied. Nothing was reported.
 I tried the same with

         help M-c^D

 and some functions (?) were reported, so the ^D-trick works with my
 vim (and M-p is free for my usage...)

 I wrote in my ${HOME}/.vimrc the following line:

                 nmap <F8> $A <C-O>p

 which works as it should.

 Now I changed the line to

         nmap <M-p> $A <C-O>p

 which does no longer work: It inserts the yanked text right in
 place. Looks like <M- was ingnored.

Many, if not all, Unix terminals generate such alt-sequences
that vim just does not undestand as <M-x>. What happens in your
case is probably that (1) Alt-p generates <esc>p and (2) vim totally
does not perceive connection between Alt-p and the mapping
nmap <M-p> ... (although it should, and this is unfortunate. But
Bram insists this is bug in terminal emulators and not vim's problem).
So your mapping is not triggered. It is the 'p' in <esc> that pastes
in the wrong place. (This is true. You can see that Alt-p will paste
even without your mapping).

So, what are your possible solutions ?

1. try :nmap <esc>p $A <C-O>p
This seems to work as long as Alt-p generates <esc>p

2. Try other keys for mapping, avoiding Alt- keys.

3. Try my old tip http://www.vim.org/tips/tip.php?tip_id=738
that fixes mapping for meta-keys

Yakov

Reply via email to