X11 clipboard - possible way forward
- I tihnk I understand this enough now to propose a 'proper' solution;
unfortunately, it's not especially simple.
The *simple* solution is to always write to the X CLIPBOARD selection at
the same time as writing to the PRIMARY one (as is currently done). That
requires X11/Xmu/Atoms.h to be included in the relevant file, two calls to
claim the selection where there's currently one and for vi mto be linked
That solution ought also to check both upon pasting, but it becomes
non-trivial then (i.e., I don't know enough to do it!). You'd probably
need to check for Xmu in configure as well.
This way solbes most communication issues, but I don't think it's
The trickier, more correct way, would be to map "* to the CLIPBOARD
selection completely *instead* of the PRIMARY selection - this basically
makes the "clipboard" definition of "* correct.
But the tricky bit is then to claim & set the PRIMARY selection to that
that vim thinks *is* selected (i.e., VISUAL/SELECT mode). The reason I
think that might be a bit tricky is because I don't think that that area
of text exists in a separate section in the same way as the section of
text held in the "* register is, so it'd be difficult to keep track of it
as far as informing X is concerned - I may be wrong.
The current options to allow automatic setting of the CLIPBOARD (i.e.,
"* register) upon a selection (by key/mouse/etc.) would still be valid and
All this really does is export vim's concept of the highlighted section
of text to X (as PRIMARY) as well as vim's CLIPBOARD.
This method also, however, requires a two-phase 'paste' - use PRIMARY if
available, else use CLIPBOARD.
The use of X11's permanent stores, CUT_BUFFERn, I think, ought to be
tackled as a separate issue, if at all, since now I understand it, they're
not really relevant; only xterm seems to use them.
It might be a noce idea, as someone suggested, to have an X-only option
to map registers a-h to CUT_BUFFER0-7, but I'm not really certain how much
use that really would be in practise (really only for people with
over-complicated xterm cut'n'paste (!) and vims in different xterms on
different machines to talk to each other in complex ways).
So. Any takers? :-)
=====================- http://www.racaldefence.com/ -===================
Neil Bird |
| This .signature is
mailto:neil.bird@... | certified Y2K compliant