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.


  • 1
    The whole point of :set paste is to not expand mappings. It would be a bug, if the mapping worked. – Christian Brabandt Jul 21 '16 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 '16 at 8:56
  • doesn'T Shift+Insert do this by default and you don't need paste mode at all? – Christian Brabandt Jul 21 '16 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 '16 at 12:30
  • 1
    This is gvim right? You shouldn't need paste mode there at all. – Christian Brabandt Jul 21 '16 at 12:41

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.