Monday, April 23, 2012

Re: gvim auto copy selected text to clipboard

On Mon, Apr 23, 2012 at 02:57:58AM EDT, Gary Johnson wrote:
> On 2012-04-22, Chris Jones wrote:
> > On Sun, Apr 22, 2012 at 02:11:47PM EDT, Gary Johnson wrote:

[..]

> What are you, my English teacher? It's probably a defensive habit to
> give myself wiggle room. (Note the careful use of "probably" instead
> of "think".) You want to be my shrink, too? No offense taken. And
> none intended, honestly.

:-)

Forgive me... was in a 'funny' mood last night.. pixilated, perhaps..

> > The ':registers' command is the healthier methodology when
> > monitoring cut's, copy's & paste's.

> Good idea. With that, I did some experimentation.

That was supposed to be the useful part.

The idea being that part of the problem is often in the mind, rather
than actual facts. I'm not claiming that once I started using the :reg
command to check the contents of Vim's registers on a regular basis all
the problems just went away, but at least those problems that remained
were genuine, not something I was making up.

> Case 1:
> clipboard=unnamedplus,unnamed,autoselect,exclude:cons\|linux
>
> Copy text from a GNOME Terminal by dragging the mouse over it
> with the left button held down.
>
> ":registers" shows selected text in the * register. The
> contents of the + and " registers are unchanged from before the
> copy operation.
>
> ":put" pastes the contents of the + register, not what I wanted.
>
> Case 2:
> clipboard=unnamed,unnamedplus,autoselect,exclude:cons\|linux
>
> Copy text from a GNOME Terminal as before. ":registers" shows
> the same results as before, as expected.
>
> ":put" again pastes the contents of the + register.
>
> Case 3:
> clipboard=unnamed,autoselect,exclude:cons\|linux
>
> Copy text from a GNOME Terminal as before. ":registers" shows
> the same results as before, as expected.
>
> ":put" now pastes the contents of the * register.

I'm still running Vim 7.2, so I have not had the opportunity to use
unnamedplus as yet. My experience is limited to Case 3.

> So it appears that the only way to paste from the * register without
> explicitly naming it is to exclude "unnamedplus" from the 'clipboard',
> and that means that unnamed yanks from Vim go only to the * register
> and not the + register, which then means that Ctrl-V in Firefox won't
> paste that yanked text. That's really fine with me since I paste into
> X applications other than Vim with the middle mouse button, not
> Ctrl-V, but it's not what the OP wanted.

That's also what I am seeing (Case 3). But I run Vim under GNU/screen
which I have customized to write to what Vim sees as the + register,
X11's PRIMARY selection, IIRC.

From a more general perspective, the OP could use the 'autocutsel'
program that keeps X11's clipboard & primary selection in sync'.

> By naming registers, you can copy and paste any way you like in Vim,
> but I don't see a way to copy from Vim to another X application, or
> from another X application to Vim, without having to know about both
> the + and * registers. It would be nice if there was some way to
> avoid all that thinking.

Another approach would be to figure out if there's any way GTK apps can
be made to always use either the clipboard ("*) or X11's PRIMARY ("+)
rather than a mix of both depending on what copy/paste mechanisme you
are using.

Best,

CJ

--
SOMEBODY SET UP US THE BOMB

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: