On Sat, Dec 04, 2010 at 04:28:07PM +0800, Yue Wu wrote: > I also notice, the yanking is fine for xterm, but after leaving vim, the > string > will become garbled even when paste in xterm.
This is due to the way that copy/pasting works in X. When you copy
something, the applications just flags itself as "owning" the clipboard
("*) or primary ("+) selection. When you paste, the application
receiving the paste checks whether any other application has claimed
ownership of the proper selection and, if so, requests that application
to provide the copied text.
If you close the application which performed the copy, then there's no
way to request that text from it. So some applications, like Vim and
xterm, will also store the copied text into a deprecated facility called
a cut buffer when they lose ownership of the selection (like when they
quit). The problem here is that the cut buffer MUST be latin1 encoded.
Long story short, if you want non-lossy cut/paste then leave Vim open
until after you paste. Alternatively, install a clipboard manager (such
as glipper or klipper) which monitors for ownership and immediately
requests the contents of the copied text from the asserting
application. You can also use a more manual tool like xclip to achieve
the same effect.
--
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[email protected]>
signature.asc
Description: Digital signature
