Monday, April 23, 2012

Re: gvim auto copy selected text to clipboard

On 2012-04-23, Christian Brabandt wrote:
> Hi Gary!
>
> On So, 22 Apr 2012, Gary Johnson wrote:
>
> > 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.
> >
> > 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 should probably be documented. Here is a doc patch:
> diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt
> --- a/runtime/doc/change.txt
> +++ b/runtime/doc/change.txt
> @@ -977,6 +977,11 @@
> current line). This always works |linewise|, thus
> this command can be used to put a yanked block as new
> lines.
> + If no register is specified, it depends on the 'cb'
> + option, if 'cb' contains "unnamed", paste from
> + * register |quotestar|, if 'cb' also contains
> + "unnamedplus", use + register |quoteplus|, else paste
> + from the unnamed register |quote_quote|.
> The cursor is left on the first non-blank in the last
> new line.
> The register can also be '=' followed by an optional

Hi Christian,

Because the presence of "unnamedplus" trumps "unnamed", I think it
would be more clear if the options were described in this order.

if 'cb' contains "unnamedplus"
paste from "+
else if 'cb' contain "unnamed"
paste from "*
else
paste from ""

In English, something like this.

If no register is specified, it depends on the 'cb'
option. If 'cb' contains "unnamedplus", paste from
the + register |quoteplus|. Otherwise, if 'cb'
contains "unnamed", paste from the * register
|quote_star|. Otherwise, paste from the unnamed
register |quote_quote|.

Regards,
Gary

--
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: