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.
:set paste
is to not expand mappings. It would be a bug, if the mapping worked.Shift+Insert
= paste contents) inpaste mode
?<S-Insert>
string, but I want to behave like Shift+Insert in the terminal (paste clipboard contents).