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
-- 
  -- Ingo Karkat -- /^-- /^-- /^-- /^-- /^-- /^-- http://ingo-karkat.de/ --
  --      http://vim.sourceforge.net/account/profile.php?user_id=9713    --

-- 
You received this message from the "vim_dev" 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

Reply via email to