Bram,

I use X11 with clipboard=unnamed,unnamedplus. Presently, if I want to write to 
both @* and @+, I have to do let @+=foo | let @*=@+ or something similar, and 
setreg(v:register, foo) only sets the plus register. I introduced a new 
register, @&, that writes to both * and + using either let @&=foo or 
setreg(v:register, foo). I attached the patch. If you think it's a good idea, 
I'll update the documentation as well.

Thanks,
Jake

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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -8918,6 +8918,7 @@
 # ifdef FEAT_CLIPBOARD
 		    || *arg == '*'
 		    || *arg == '+'
+		    || *arg == '&'
 # endif
 		    || *arg == '"')
 	    {
diff --git a/src/normal.c b/src/normal.c
--- a/src/normal.c
+++ b/src/normal.c
@@ -9292,7 +9292,8 @@
 	   if (regname == 0 || regname == '"'
 				     || VIM_ISDIGIT(regname) || regname == '-'
 #ifdef FEAT_CLIPBOARD
-		    || (clip_unnamed && (regname == '*' || regname == '+'))
+		    || (clip_unnamed &&
+			(regname == '*' || regname == '+' || regname == '&'))
 #endif
 
 		    )
diff --git a/src/ops.c b/src/ops.c
--- a/src/ops.c
+++ b/src/ops.c
@@ -847,6 +847,7 @@
 #ifdef FEAT_CLIPBOARD
 	    || regname == '*'
 	    || regname == '+'
+	    || regname == '&'
 #endif
 #ifdef FEAT_DND
 	    || (!writing && regname == '~')
@@ -894,7 +895,7 @@
     else if (clip_star.available && regname == '*')
 	i = STAR_REGISTER;
     /* When clipboard is not available, use register 0 instead of '+' */
-    else if (clip_plus.available && regname == '+')
+    else if (clip_plus.available && (regname == '+' || regname == '&'))
 	i = PLUS_REGISTER;
 #endif
 #ifdef FEAT_DND
@@ -917,7 +918,16 @@
 may_get_selection(regname)
     int regname;
 {
-    if (regname == '*')
+    if (regname == '&')
+    {
+	if (clip_plus.available)
+	    clip_get_selection(&clip_plus);
+	else if (clip_star.available)
+	    clip_get_selection(&clip_star);
+	else
+	    regname = 0;
+    }
+    else if (regname == '*')
     {
 	if (!clip_star.available)
 	    regname = 0;
@@ -956,7 +966,7 @@
 	    clip_update_selection(&clip_star);
 	may_get_selection(name);
     }
-    if (name == '+' && clip_plus.available)
+    if ((name == '+' || name == '&') && clip_plus.available)
     {
 	if (clip_isautosel_plus())
 	    clip_update_selection(&clip_plus);
@@ -1598,12 +1608,20 @@
     /* If no reg. specified, and "unnamed" or "unnamedplus" is in 'clipboard',
      * use '*' or '+' reg, respectively. "unnamedplus" prevails. */
     if (*rp == 0 && clip_unnamed != 0)
-	*rp = ((clip_unnamed & CLIP_UNNAMED_PLUS) && clip_plus.available)
-								  ? '+' : '*';
+    {
+	if (clip_unnamed == (CLIP_UNNAMED | CLIP_UNNAMED_PLUS)
+		&& clip_plus.available && clip_star.available)
+	    *rp = '&';
+	else
+	    *rp = ((clip_unnamed & CLIP_UNNAMED_PLUS) && clip_plus.available)
+		? '+' : '*';
+    }
     if (!clip_star.available && *rp == '*')
 	*rp = 0;
     if (!clip_plus.available && *rp == '+')
 	*rp = 0;
+    if (!(clip_star.available && clip_plus.available) && *rp == '&')
+	*rp = 0;
 }
 #endif
 
@@ -1734,8 +1752,9 @@
 	 * and the delete is within one line. */
 	if ((
 #ifdef FEAT_CLIPBOARD
-	    ((clip_unnamed & CLIP_UNNAMED) && oap->regname == '*') ||
-	    ((clip_unnamed & CLIP_UNNAMED_PLUS) && oap->regname == '+') ||
+	     ((clip_unnamed & CLIP_UNNAMED) && oap->regname == '*') ||
+	     ((clip_unnamed & CLIP_UNNAMED_PLUS)
+	      && (oap->regname == '+' || oap->regname == '&')) ||
 #endif
 	    oap->regname == 0) && oap->motion_type != MLINE
 						      && oap->line_count == 1)
@@ -2958,7 +2977,8 @@
 #ifdef FEAT_CLIPBOARD
     if (!clip_star.available && oap->regname == '*')
 	oap->regname = 0;
-    else if (!clip_plus.available && oap->regname == '+')
+    else if (!clip_plus.available
+	    && (oap->regname == '+' || oap->regname == '&'))
 	oap->regname = 0;
 #endif
 
@@ -6454,6 +6474,15 @@
 	return;
     }
 
+#ifdef FEAT_CLIPBOARD
+    /* Special case: set both star and plus */
+    if (name == '&')
+    {
+	write_reg_contents_ex('*', str, maxlen, must_append, yank_type, block_len);
+	write_reg_contents_ex('+', str, maxlen, must_append, yank_type, block_len);
+    }
+#endif
+
 #ifdef FEAT_EVAL
     if (name == '=')
     {

Raspunde prin e-mail lui