Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Due to the lack of security with standard vino server, I switched to use x11vnc on my linux (with Xubuntu 14.04) box and SSVNC on the windows side.

With vino, cut and paste from windows to Linux and windows, in the two directions, was flaky(1) but when it worked, it worked for every program; I could use the vim register "+ without problem. I run(2)

autocutsel -fork 

normally so that the "middle click" and ctrl-c/v selections are the same.

Now that I use x11vnc (called with: x11vnc -forever -repeat -safer -usepw -ssl -autoport 6000) to have a safe, encrypted connection, a problem arose:

  1. I can copy on windows and paste in the remote linux terminals, libreoffice etc. without any problem, in both directions.

  2. In vim, or gvim, any attempt to paste with "+p or "*p says E353: Nothing in register *

  3. Again in vim or gvim, the other way around does work: if I "+yy then I can paste the thing on the Windows side.

As anyone any clue about this problem? The strange thing is that paste works everywhere I checked but in vim...

Package                 Installed       Previous        Now             State
=======================-===============-===============-===============-=====
vim                     2:7.4.052-1ubuntu3  2:7.4.052-1ubuntu3  2:7.4.052-1ubuntu3  install
vim-gnome               2:7.4.052-1ubuntu3  2:7.4.052-1ubuntu3  2:7.4.052-1ubuntu3  install

Footnotes:

(1) can't find the bug now --- it is reported. It stops working after a while.

(2) I tried with and without. No changes.

share|improve this question
    
I had many problems with x11vnc related to different language locales on host and client, especially when controlling vmware guests through vnc on the server. I finally 'solved' it by installing a nomachine server on the host system. I know that this is probably not the solution you have in mind, but nomachine and nxclient is both secure, very fast and everything is tunneled through ssh. –  Floyd Oct 10 '14 at 15:27
2  
I don't use vnc, but I fixed all my problems with clipboard interoperability between vim and OSes by: (1) using set clipboard=unnamedplus in every linux I use (2) alias vim='gvim -v' in my .bashrcs (to work around certain distributions compiling vim without X clipboard support) (3) set clipboard=unnamed in windows. Hope it helps. –  Patryk Obara Nov 26 '14 at 20:25
    
@PatrykObara will try... next time I have to use a windows PC. I have a Linux only setup now and no problems... Thanks. –  Rmano Nov 26 '14 at 20:28
1  
See: How can I copy text to the system clipboard from Vim? at Vim SE –  kenorb Feb 22 at 17:20

1 Answer 1

Since I do not know which x11vnc you are using (I have three different versions, there are others) this is a tutorial to troubleshoot this specific problem.

First is to understand the clipboards involved. There are in most cases four of them involved. (More is possible if you use clipboard management tools.) X11 defines three clipboards: Primary, Secondary, and Clipboard. Secondary is seldom used, (and is almost certainly not your problem) so we will ignore it. Applications that use middle click to paste (xterm, et al) normally use the primary clipboard. Applications that do a windows style paste (click edit, click paste or control V) sometimes use just the clipboard clipboard. Some applications do both (Google Chrome pastes from primary with a middle click and from clipboard with a control V). Next is the VNC clipboard (just one) and there is the windows clipboard. (If you are using a vnc viewer running on X11, things get more complicated, but that will make sense after thinking about this.) the VNC clipboard is special in that it keeps track of various updates of the other clipboards to keep them up to date. If you ignore the primary clipboard, this is fairly simple in that the most recently updated clipboard is copied to all the others. The challenge is that the desired behaviour of the primary clipboard is not well defined. I have seen the following behaviours of various vnc implementations:

  1. Ignore the primary, use the clipboard only.
  2. Ignore the clipboard, use the primary only.
  3. Use the most recent for unix to windows copies, copy to both for windows to unix copies.
  4. Try to be smart: use the primary only until the clipboard is used then only use the clipboard.
  5. Try to be smarter: use the primary until the clipboard is changed then ignore the primary until there is a change from windows, then use the next changed, again ignoring the primary after clipboard use.
  6. Try to be even smarter. (I never figured out what they were trying to do with this one, but usually it did the right thing)

Next is the tools. There are two tools I consider essential for debugging clipboard issues: a text editor (notepad works fine for this) and xclip. A windows clipboard viewer is nice but not essential.

Now the procedure: From each application in the group you are troubleshooting, select and copy some text checking the status of all three accessible clipboards. (The vnc clipboard is very difficult to view directly and not directly useful as it normally does not store the data, only the metadata.) answer these questions: which clipboard does each application use? what order are they used?

Hopefully this is enough information to get you started.

share|improve this answer
    
Thanks! I unfortunately can't test right now, I have almost ditched windows out of my PCs ;-). Will try some investigation as soon I am forced to use Windows again... –  Rmano Mar 16 at 20:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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