5

I want to be able to paste from the clipboard on gVim on Windows using Ctrl-Shift-V, just like in Terminator.

However, if I put this on my .vimrc

 imap <C-S-V> "+gP

The shortcut works without shift, meaning I can paste text with a simple Ctrl-V. This overrides the already existing capability, is there a way to paste only with Ctrl-Shift-V?

  • I don't think Windows supports multiple clipboards, it will be interesting to see responses to this. – krystah Feb 11 '14 at 18:16
  • 2
    I don't think Vim makes a difference between <C-S-v> and <C-v>. – romainl Feb 11 '14 at 21:37
6

Vim cannot see the difference between <C-V>, <C-v>, and <C-S-V>.

If you want case sensitive mappings, you need to use unmodified characters, or the Alt key (e.g. <A-v> or <M-v> is different from <A-V> or <M-V>).

| improve this answer | |
3

Due to the way that the keyboard input is handled internally, this unfortunately isn't generally possible today, even in GVIM. Some key combinations, like Ctrl + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished. (Unless your terminal sends a distinct termcap code for it, which most don't.) In insert or command-line mode, try typing the key combination. If nothing happens / is inserted, you cannot use that key combination. This also applies to <Tab> / <C-I>, <CR> / <C-M> / <Esc> / <C-[> etc. (Only exception is <BS> / <C-H>.) This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.

Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals, cp. http://groups.google.com/group/vim_dev/browse_thread/thread/626e83fa4588b32a/bfbcb22f37a8a1f8

But as of today, no patches or volunteers have yet come forward, though many have expressed a desire to have this in a future Vim 8 major release.

| improve this answer | |
1

You can program the Ctrl-Shift-v to be intercepted by the terminal itself not vim, you can configure how that interception happens.

For me, I launch Konsole application, Click the Settings Menu -> Configure shortcuts -> Search for Ctrl+Shift+v and remap that to Ctrl-V. So now this keyboard combination will not make it through to vim, and you can have Konsole do the right thing to paste the clipboard contents.

enter image description here

If you are using some terminal other than Konsole, you might search around for its functionality to intercept that keyboard combination and then hand-hold vim so it does the right thing.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.