Copying from Vim to Windows Clipboard

While using Xshell, or a similar terminal program, and in Vim, you are unable to copy yanked text nor the selection in mouse mode to the Windows Clipboard. This can be frustrating if you need to copy something from Vim into a Windows application such as notepad. However, using vim-x11, we can circumvent this issue and successfully copy the contents of Vim to the Windows Clipboard.

In Vim, the * and + registers are the registers which reference the system clipboard. The clipboard in this case, however, is the clipboard of the remote system, not the Windows Clipboard we desire. If you're utilizing X11 in your PC by using Xmanager, we can use the connection between the remote system and Windows.


  1. If your remote system does not have the vimx command, you'll need to install vim-X11 in your remote system first.  The result of 'vim --version |grep clipboard' should contain '+clipboard'

  2. Install Xmanager.

  3. Run Xshell and connect to the server using the SSH protocol with X11 forwarding.

  4. Run vimx instead of vim or vi.

  5. Select the area you want to copy to the clipboard using the vim selection method.

  6. Place the contents into the clipboard register using the "+y key strokes.

  7. Paste the contents in your desired Windows application such as notepad.