22

I am running Vim 6.3 through putty and putty connection manager. I have the mouse option set (set mouse = a). I am able to paste things from the (windows) clipboard to vim by but selecting text in vim isn't copying anything to the clipboard. Does anyone know how do I do this?

Note: I can't update Vim to a newer version.

Pulkit Sinha
  • 2,654
  • 4
  • 19
  • 20

4 Answers4

68

Hold down shift, and then highlight the text you want to copy using the left mouse button. When you release, the highlighted text should be in the Windows clipboard.

Matt Dunn
  • 5,106
  • 6
  • 31
  • 55
  • 6
    While this works, it isn't exactly what I'm looking for. Instead of copying everything from the beginning to the end of the selection, it copies everything in the box. Is there a way to getting things to the clipboard after I've made the selection? – Pulkit Sinha Nov 30 '10 at 11:55
  • Set selection mode to normal in Putty configuration (Window/Selection). I can copy and paste from putty as from any other window app. – jira Nov 30 '10 at 15:51
  • The selection mode is normal, I still get the box. Maybe it is an issue with Putty Connection Manager? – Pulkit Sinha Dec 01 '10 at 06:38
  • 1
    Not sure. I use left Mouse to select and Ctlr-C to copy from vim and it works. – jira Dec 01 '10 at 13:39
  • I can only use this to copy what is in the box. Scrolling doesn't work. I'm using MTPutty. – kapad Feb 18 '15 at 19:57
  • 1
    This should have been the accepted answer. One thing to note is if you have number lines showing, it might be better to hold down Shift and Alt (windows). – Webmaster G Sep 21 '17 at 16:56
  • Hold Alt for block select. – aiwl Jul 02 '21 at 14:37
6

You can select some text with the mouse and then type:
"*y to yank the selected text to the clipboard, then you should be able to use the clipboard content in another application.

if "*y is to cumbersome to type, you can put the following in host .vimrc
:noremap y "*y

Xavier T.
  • 40,509
  • 10
  • 68
  • 97
  • This did not copy the text to clipboard. I don't know where it copied it, but Dunnie's answer should have been accepted based on the current state of Putty. – Webmaster G Sep 21 '17 at 16:57
  • had the same issue with MobaXterm on Windows and vim in ssh. For me it worked after adding `ForwardX11Trusted yes` to my `~/.ssh/config` as explained [here](https://superuser.com/questions/326871/using-clipboard-through-ssh-in-vim) and get `vim-gnome` to add the clipboard feature as explained [here](https://vi.stackexchange.com/questions/84/how-can-i-copy-text-to-the-system-clipboard-from-vim) – Wolfson May 05 '20 at 15:32
  • since on Windows there is no difference between the `*` (copy-on-select) and the `+` (Ctrl+C) register, using the default register with `"y` works. Go into visual mode with `v` and following navigation moves instead of using the mouse for text selection works as well. – Wolfson May 08 '20 at 09:44
5

Ctrl-Insert to copy, Shift-Insert to paste

geoffc
  • 4,030
  • 7
  • 44
  • 51
  • 1
    How to copy all lines(include the lines that don't display in the window)? It only can copy the lines that display in the screen. – niaomingjian Jan 19 '17 at 12:59
3

Do not use mouse=a.
Put the mouse in commandline mode (:set mouse=c).
Then you can just select your text to put it in the system clipboard (as with all other PUTTY/KITTY commands),

bilbo
  • 111
  • 1
  • 3
  • 1
    This is correct, but why is that? I would like the mouse selection to use the visual mode in vim and y to copy to selection to all clipboards. – roeland Jul 18 '19 at 10:55