0

I have a Windows client with gvim for Windows 7.4. I want Shift+Insert to work as "Paste", so I added the following settings to ~/_vimrc:

nnoremap <S-Insert> "+gP 
inoremap <S-Insert> <Esc>"+gP<CR>i

This makes S+Insert work properly (paste the clipboard contents) in the following cases:

  • Normal mode.
  • Insert mode with :set nopaste active.

But when Shift+Insert is pressed in Insert mode with :set paste, then instead of the clipboard contents, the string <S-Insert> is inserted into the document.

I found this similar question (After ":set paste" executed "insert mode's remaps" stop working - VIM (iTerm2)) but related to iTerm2 (it's 1 year old) but I cannot believe there is no solution in Vim for this.

Thanks.

5
  • 1
    The whole point of :set paste is to not expand mappings. It would be a bug, if the mapping worked. Jul 21, 2016 at 8:42
  • Thanks for answering. It's OK if that's the expected behaviour, but ... is there any other way (no mappings) to achieve what I expect (Shift+Insert = paste contents) in paste mode?
    – sromero
    Jul 21, 2016 at 8:56
  • doesn'T Shift+Insert do this by default and you don't need paste mode at all? Jul 21, 2016 at 9:04
  • When I'm in insert mode, it does not work. It just inserts the <S-Insert> string, but I want to behave like Shift+Insert in the terminal (paste clipboard contents).
    – sromero
    Jul 21, 2016 at 12:30
  • 1
    This is gvim right? You shouldn't need paste mode there at all. Jul 21, 2016 at 12:41

0

You must log in to answer this question.

Browse other questions tagged .