Loading ...
Sorry, an error occurred while loading the content.

106269Re: Mapping does not work

Expand Messages
  • Charles Campbell
    Jul 31, 2009
      J.A.J. Pater wrote:
      > One way or another a mapping I'm trying to implement doesn't work.
      > I'm trying to paste with CTRL-V only in insert mode and keep using
      > CTRL-V for visual in other modes.
      > In my .vimrc I've got:
      > imap <C-V> "+gP
      > The only thing I get when pushing CTRL-V in insert mode is the literal
      > text "+gP
      > But not the desired effect: pasting.
      > I tried with inoremap also, but to no avail.
      > What could be wrong?
      The imap takes effect during insert mode; it does not, by itself, change
      modes. In other
      words, the "+gP is acting like keys that you type. Obviously, what you
      want is what
      "+gP does in normal mode; hence, your imap needs to leave insert mode
      and enter
      normal mode. Turns out there's a convenient one-shot insert-mode
      command for that

      imap <c-v> <c-o>"+gP

      Chip Campbell

      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 6 messages in this topic