On Mon, 3 Sep 2012, Christian Brabandt wrote:
> On Mo, 03 Sep 2012, Ingo Karkat wrote:
> > Hello Vim developers,
> > 
> > This issue came up on Reddit
> > (http://www.reddit.com/r/vim/comments/yyq4a/is_there_anyway_to_configure_vim_to_use_the/).
> > 
> > With :set clipboard=unnamed, small deletes (such as "dw") affect the named
> > registers "1.."9. I can reproduce this with vanilla Vim 7.3.000 on 
> > Windows/x86,
> > and the latest Vim 7.3.646 on Ubuntu/x86.
> > 
> > It appears that the setting triggers the exception from the rule "This 
> > register
> > ("-) contains text from commands that delete less than one line, except 
> > when the
> > command specifies a register with ["x].", although the register here comes 
> > from
> > the implementation, not the user.
> > 
> > Based on the Reddit posting, some people apparently prefer this behavior 
> > (though
> > I personally dislike that multiple "x" commands will rapidly fill the number
> > registers with single characters), so maybe there should be (yet another) 
> > option
> > for that. ('smalldeletethreshold', with 0 = off, 1 = all, and N = for 
> > deletes
> > equal or larger than N characters?!)
> 
> This patch just fixes this side effect. I don't think, it warrants yet 
> another option.

I haven't been active on this list.  I apologize if reviving a year-
old post violates list etiquette, but it seems like the easiest way to 
reference the issue.

I for one am one of those poor misguided souls who quite regularly 
abused this accidental side effect.  I was rather disturbed by its 
disappearance with my recent upgrade from the vim 7.3 shipped with 
debian wheezy.  I do think this warrants an option, so I've made an 
attempt to implement one.  This is my first time poking around in 
vim's innards.  I'd love to get some feedback.  Did I do this right?  
Would a different name make more sense?  Also, is there any chance of 
getting this patch accepted?  I am reasonably certain that there are 
quite a few of those people who prefer the earlier behavior.

Thank you and best regards,
Aryeh Leib Taurog


diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt
--- a/runtime/doc/change.txt
+++ b/runtime/doc/change.txt
@@ -1126,6 +1126,9 @@
 made for the delete operator with these movement commands: |%|, |(|, |)|, |`|,
 |/|, |?|, |n|, |N|, |{| and |}|.  Register "1 is always used then (this is Vi
 compatible).  The "- register is used as well if the delete is within a line.
+If 'regone' is set, both registers "1 and "- will always be used for small
+deletes, regardless of the movement commands used (this option is not Vi
+compatible).
    With each successive deletion or change, Vim shifts the previous contents
 of register 1 into register 2, 2 into 3, and so forth, losing the previous
 contents of register 9.
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -5581,6 +5581,16 @@
        that is not supported the pattern will not match.  This is only useful
        for debugging the regexp engine.
 
+'regone' 'rgo'         boolean (default off)
+                       global
+                       {not in Vi}
+       When set, a delete which would normally be stored only in the small
+       delete register will also be pushed onto the number register stack,
+       that is the number registers will be shifted down and the delete
+       contents will be stored in numbered register 1.
+       See |quote_number| and |quote_-|.
+       NOTE: This option is set to false when 'compatible' is set.
+
                *'relativenumber'* *'rnu'* *'norelativenumber'* *'nornu'*
 'relativenumber' 'rnu' boolean (default off)
                        local to window
diff --git a/src/ops.c b/src/ops.c
--- a/src/ops.c
+++ b/src/ops.c
@@ -1736,7 +1736,7 @@
         * Use the register name from before adjust_clip_reg() may have
         * changed it.
         */
-       if (orig_regname != 0 || oap->motion_type == MLINE
+       if (orig_regname != 0 || p_rgo || oap->motion_type == MLINE
                                   || oap->line_count > 1 || oap->use_reg_one)
        {
            y_current = &y_regs[9];
diff --git a/src/option.c b/src/option.c
--- a/src/option.c
+++ b/src/option.c
@@ -2098,6 +2098,9 @@
     {"regexpengine", "re",  P_NUM|P_VI_DEF,
                            (char_u *)&p_re, PV_NONE,
                            {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
+    {"regone",     "rgo",  P_BOOL|P_VI_DEF|P_VIM,
+                           (char_u *)&p_rgo, PV_NONE,
+                           {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
     {"relativenumber", "rnu", P_BOOL|P_VI_DEF|P_RWIN,
                            (char_u *)VAR_WIN, PV_RNU,
                            {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
diff --git a/src/option.h b/src/option.h
--- a/src/option.h
+++ b/src/option.h
@@ -655,6 +655,7 @@
 EXTERN long    p_rdt;          /* 'redrawtime' */
 #endif
 EXTERN int     p_remap;        /* 'remap' */
+EXTERN int     p_rgo;          /* 'regone' */
 EXTERN long    p_re;           /* 'regexpengine' */
 EXTERN long    p_report;       /* 'report' */
 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)

-- 
-- 
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/groups/opt_out.

Raspunde prin e-mail lui