Reply to message «PATCH: v:register value with clipboard=unnamed,unnamedplus», 
sent 00:47:38 17 January 2011, Monday
by Ingo Karkat:

> I would propose changing the default value of v:register in case of
> selection=unnamed from '"' to '*' (and correspondingly for
> selection=unnamedplus to '+'), like this:
According to the help, this variable must be empty if no registers were 
supplied, so it is better to make it behave like documented.

Original message:
> Hello Vim developers,
> 
> With :set clipboard^=unnamed, operations are redirected from the unnamed
> register '"' to register '*'. If one wants to use the unnamed register, it
> has to be explicitly specified, e.g. ""yy.
> 
> When this register redirection is active, v:register contains '"' (default
> as no register was specified), even though (due to the 'clipboard'
> setting), '*' is actually used. This discrepancy breaks plugins (like
> smartput, and my UnconditionalPaste) which directly use v:register for
> users with such 'clipboard' settings. Even worse, there's no way to
> differentiate between an explicitly specified unnamed register (""yy) and
> Vim defaulting to it (yy), and thus no way for scripts to accommodate
> these non-default settings of 'clipboard'!
> 
> I would propose changing the default value of v:register in case of
> selection=unnamed from '"' to '*' (and correspondingly for
> selection=unnamedplus to '+'), like this:
> 
> diff --git a/src/normal.c b/src/normal.c
> --- a/src/normal.c
> +++ b/src/normal.c
> @@ -1202,7 +1202,9 @@
>      {
>       clearop(oap);
>  #ifdef FEAT_EVAL
> -     set_reg_var('"');
> +     int regname = 0;
> +     adjust_clip_reg(&regname);
> +     set_reg_var(regname);
>  #endif
>      }
> 
> With this change, the above mentioned plugins will "just work" without any
> modifications, and I think this is actually a more sensible behavior for
> v:register. An alternative would be to empty v:register when no register
> was explicitly specified, but that change would not be backward
> compatible.
> 
> -- regards, ingo

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to