Loading ...
Sorry, an error occurred while loading the content.

modification for patch 6.2.298

Expand Messages
  • Bram Moolenaar
    After using g, for a while, I get annoyed that a position is remembered for every change. Doing xxxxxx creates six positions. It s probably a good idea to
    Message 1 of 14 , Mar 1, 2004
    • 0 Attachment
      After using "g," for a while, I get annoyed that a position is
      remembered for every change. Doing "xxxxxx" creates six positions.

      It's probably a good idea to only remember a position when it's in a
      different line than the previous change. The patch below does this.
      If there are no remarks then I'll make it work this way.

      It also fixes a bug for storing the changelist in the viminfo file.
      And adds error messages for when trying to go past the end of the
      changelist.


      *** ../vim-6.2.301/runtime/doc/motion.txt Sun Feb 29 20:46:43 2004
      --- runtime/doc/motion.txt Mon Mar 1 14:34:20 2004
      ***************
      *** 963,978 ****
      CHANGE LIST JUMPS *changelist* *change-list-jumps*

      For changes the cursor position is remembered. One position is remembered for
      ! every change that can be undone. Two commands can be used to jump to
      positions of changes, also those that have been undone.

      ! *g;*
      g; Go to [count] older cursor position in change list
      (not a motion command).
      {not in Vi}
      {not available without the +jumplist feature}

      ! *g,*
      g, Go to [count] newer cursor position in change list
      (not a motion command).
      {not in Vi}
      --- 971,987 ----
      CHANGE LIST JUMPS *changelist* *change-list-jumps*

      For changes the cursor position is remembered. One position is remembered for
      ! every change that can be undone. But for consecutive changes in the same line
      ! only one position is remembered. Two commands can be used to jump to
      positions of changes, also those that have been undone.

      ! *g;* *E662*
      g; Go to [count] older cursor position in change list
      (not a motion command).
      {not in Vi}
      {not available without the +jumplist feature}

      ! *g,* *E663*
      g, Go to [count] newer cursor position in change list
      (not a motion command).
      {not in Vi}
      *** ../vim-6.2.301/src/mark.c Sun Feb 29 20:46:43 2004
      --- src/mark.c Mon Mar 1 14:31:12 2004
      ***************
      *** 1470,1476 ****
      else
      ++curbuf->b_changelistlen;
      curbuf->b_changelist[
      ! curbuf->b_changelistlen] = pos;
      #endif
      break;
      default: if ((i = line[1] - 'a') >= 0 && i < NMARKS)
      --- 1470,1476 ----
      else
      ++curbuf->b_changelistlen;
      curbuf->b_changelist[
      ! curbuf->b_changelistlen - 1] = pos;
      #endif
      break;
      default: if ((i = line[1] - 'a') >= 0 && i < NMARKS)
      *** ../vim-6.2.301/src/misc1.c Sun Feb 29 20:46:43 2004
      --- src/misc1.c Mon Mar 1 14:17:27 2004
      ***************
      *** 2505,2514 ****
      curbuf->b_last_change.col = col;

      #ifdef FEAT_JUMPLIST
      ! if (curbuf->b_new_change)
      {
      ! /* This is the first of a new sequence of undo-able changes.
      ! * Use a new position in the changelist. */
      curbuf->b_new_change = FALSE;

      if (curbuf->b_changelistlen == JUMPLISTSIZE)
      --- 2514,2528 ----
      curbuf->b_last_change.col = col;

      #ifdef FEAT_JUMPLIST
      ! /* Don't create a new entry when the line number is the same as the
      ! * last one. Avoids creating many entries for typing "xxxxx". */
      ! if (curbuf->b_new_change
      ! && (curbuf->b_changelistlen == 0
      ! || curbuf->b_changelist[curbuf->b_changelistlen - 1].lnum
      ! != lnum))
      {
      ! /* This is the first of a new sequence of undo-able changes. Use
      ! * a new position in the changelist. */
      curbuf->b_new_change = FALSE;

      if (curbuf->b_changelistlen == JUMPLISTSIZE)
      *** ../vim-6.2.301/src/normal.c Sun Feb 29 21:06:13 2004
      --- src/normal.c Mon Mar 1 14:25:52 2004
      ***************
      *** 6563,6569 ****
      }

      /*
      ! * Handle CTRL-O and CTRL-I commands.
      */
      static void
      nv_pcmark(cap)
      --- 6549,6555 ----
      }

      /*
      ! * Handle CTRL-O, CTRL-I, "g;" and "g," commands.
      */
      static void
      nv_pcmark(cap)
      ***************
      *** 6589,6594 ****
      --- 6575,6587 ----
      }
      else if (pos != NULL) /* can jump */
      nv_cursormark(cap, FALSE, pos);
      + else if (cap->cmdchar == 'g')
      + {
      + if (cap->count1 < 0)
      + EMSG(_("E662: At start of changelist"));
      + else
      + EMSG(_("E663: At end of changelist"));
      + }
      else
      clearopbeep(cap->oap);
      # ifdef FEAT_FOLDING

      --
      Computers are not intelligent. They only think they are.

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
      \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
    • Benjamin Peterson
      Hi, To me personally, it would be more useful to remember the change if either line or column is different. This is because I often make changes to large data
      Message 2 of 14 , Mar 1, 2004
      • 0 Attachment
        Hi,

        To me personally, it would be more useful to remember the change if
        either line or column is different. This is because I often make
        changes to large data files that have very long lines (csv files), and
        there may be several unrelated changes far apart on the same line.

        While I am asking for things, I would also like to suggest this:

        Can we have some way to access the changes in the undo list freely, as
        well as just their locations? For instance, often I come upon a word
        that needs changing and I know I have just made a similar change, but
        there is no way to automatically reapply the change at a new location,
        so I have to type cwNewWord<cr> again. If the changes stored in the
        undo list could be pulled out and used at new locations, that would make
        editing much easier for many kinds of files.


        Benjamin






        -----Original Message-----
        From: Bram@... [mailto:Bram@...]
        Sent: Monday, March 01, 2004 2:44 PM
        To: vim-dev@...
        Subject: modification for patch 6.2.298


        After using "g," for a while, I get annoyed that a position is
        remembered for every change. Doing "xxxxxx" creates six positions.

        It's probably a good idea to only remember a position when it's in a
        different line than the previous change. The patch below does this.
        If there are no remarks then I'll make it work this way.

        It also fixes a bug for storing the changelist in the viminfo file.
        And adds error messages for when trying to go past the end of the
        changelist.


        *** ../vim-6.2.301/runtime/doc/motion.txt Sun Feb 29 20:46:43 2004
        --- runtime/doc/motion.txt Mon Mar 1 14:34:20 2004
        ***************
        *** 963,978 ****
        CHANGE LIST JUMPS *changelist* *change-list-jumps*

        For changes the cursor position is remembered. One position is
        remembered for
        ! every change that can be undone. Two commands can be used to jump to
        positions of changes, also those that have been undone.

        ! *g;*
        g; Go to [count] older cursor position in change
        list
        (not a motion command).
        {not in Vi}
        {not available without the +jumplist feature}

        ! *g,*
        g, Go to [count] newer cursor position in change
        list
        (not a motion command).
        {not in Vi}
        --- 971,987 ----
        CHANGE LIST JUMPS *changelist* *change-list-jumps*

        For changes the cursor position is remembered. One position is
        remembered for
        ! every change that can be undone. But for consecutive changes in the
        same line
        ! only one position is remembered. Two commands can be used to jump to
        positions of changes, also those that have been undone.

        ! *g;* *E662*
        g; Go to [count] older cursor position in change
        list
        (not a motion command).
        {not in Vi}
        {not available without the +jumplist feature}

        ! *g,* *E663*
        g, Go to [count] newer cursor position in change
        list
        (not a motion command).
        {not in Vi}
        *** ../vim-6.2.301/src/mark.c Sun Feb 29 20:46:43 2004
        --- src/mark.c Mon Mar 1 14:31:12 2004
        ***************
        *** 1470,1476 ****
        else
        ++curbuf->b_changelistlen;
        curbuf->b_changelist[
        ! curbuf->b_changelistlen]
        = pos;
        #endif
        break;
        default: if ((i = line[1] - 'a') >= 0 && i <
        NMARKS)
        --- 1470,1476 ----
        else
        ++curbuf->b_changelistlen;
        curbuf->b_changelist[
        ! curbuf->b_changelistlen - 1]
        = pos;
        #endif
        break;
        default: if ((i = line[1] - 'a') >= 0 && i <
        NMARKS)
        *** ../vim-6.2.301/src/misc1.c Sun Feb 29 20:46:43 2004
        --- src/misc1.c Mon Mar 1 14:17:27 2004
        ***************
        *** 2505,2514 ****
        curbuf->b_last_change.col = col;

        #ifdef FEAT_JUMPLIST
        ! if (curbuf->b_new_change)
        {
        ! /* This is the first of a new sequence of undo-able changes.
        ! * Use a new position in the changelist. */
        curbuf->b_new_change = FALSE;

        if (curbuf->b_changelistlen == JUMPLISTSIZE)
        --- 2514,2528 ----
        curbuf->b_last_change.col = col;

        #ifdef FEAT_JUMPLIST
        ! /* Don't create a new entry when the line number is the same as
        the
        ! * last one. Avoids creating many entries for typing "xxxxx".
        */
        ! if (curbuf->b_new_change
        ! && (curbuf->b_changelistlen == 0
        ! || curbuf->b_changelist[curbuf->b_changelistlen -
        1].lnum
        ! !=
        lnum))
        {
        ! /* This is the first of a new sequence of undo-able changes.
        Use
        ! * a new position in the changelist. */
        curbuf->b_new_change = FALSE;

        if (curbuf->b_changelistlen == JUMPLISTSIZE)
        *** ../vim-6.2.301/src/normal.c Sun Feb 29 21:06:13 2004
        --- src/normal.c Mon Mar 1 14:25:52 2004
        ***************
        *** 6563,6569 ****
        }

        /*
        ! * Handle CTRL-O and CTRL-I commands.
        */
        static void
        nv_pcmark(cap)
        --- 6549,6555 ----
        }

        /*
        ! * Handle CTRL-O, CTRL-I, "g;" and "g," commands.
        */
        static void
        nv_pcmark(cap)
        ***************
        *** 6589,6594 ****
        --- 6575,6587 ----
        }
        else if (pos != NULL) /* can jump */
        nv_cursormark(cap, FALSE, pos);
        + else if (cap->cmdchar == 'g')
        + {
        + if (cap->count1 < 0)
        + EMSG(_("E662: At start of changelist"));
        + else
        + EMSG(_("E663: At end of changelist"));
        + }
        else
        clearopbeep(cap->oap);
        # ifdef FEAT_FOLDING

        --
        Computers are not intelligent. They only think they are.

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net
        \\\
        /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/
        \\\
        \\\ Project leader for A-A-P -- http://www.A-A-P.org
        ///
        \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html
        ///
      • Benji Fisher
        ... A few days ago, there was a request to break up the undo history when typing many lines in Insert mode. Is there any chance of that? If not, then
        Message 3 of 14 , Mar 1, 2004
        • 0 Attachment
          On Mon, Mar 01, 2004 at 03:43:38PM +0100, Bram Moolenaar wrote:
          >
          > After using "g," for a while, I get annoyed that a position is
          > remembered for every change. Doing "xxxxxx" creates six positions.
          >
          > It's probably a good idea to only remember a position when it's in a
          > different line than the previous change. The patch below does this.
          > If there are no remarks then I'll make it work this way.
          >
          > It also fixes a bug for storing the changelist in the viminfo file.
          > And adds error messages for when trying to go past the end of the
          > changelist.

          A few days ago, there was a request to break up the "undo" history
          when typing many lines in Insert mode. Is there any chance of that? If
          not, then perhaps entering Visual mode and using the new g, (or is it
          g; ? I have not tried these patches yet...) can be a usable alternative.

          --Benji Fisher
        • Bram Moolenaar
          ... It s in the todo list (somewhere). It s not so obvious where to break undo though. Perhaps when starting to backspace, starting a new word and/or
          Message 4 of 14 , Mar 1, 2004
          • 0 Attachment
            Benji Fisher wrote:

            > On Mon, Mar 01, 2004 at 03:43:38PM +0100, Bram Moolenaar wrote:
            > >
            > > After using "g," for a while, I get annoyed that a position is
            > > remembered for every change. Doing "xxxxxx" creates six positions.
            > >
            > > It's probably a good idea to only remember a position when it's in a
            > > different line than the previous change. The patch below does this.
            > > If there are no remarks then I'll make it work this way.
            > >
            > > It also fixes a bug for storing the changelist in the viminfo file.
            > > And adds error messages for when trying to go past the end of the
            > > changelist.
            >
            > A few days ago, there was a request to break up the "undo" history
            > when typing many lines in Insert mode. Is there any chance of that?

            It's in the todo list (somewhere). It's not so obvious where to break
            undo though. Perhaps when starting to backspace, starting a new word
            and/or starting a new line.

            > If not, then perhaps entering Visual mode and using the new g, (or is
            > it g; ? I have not tried these patches yet...) can be a usable
            > alternative.

            Any command that leaves Insert mode for a moment is sufficient to start
            a new undo-able insert. Cursor up and then Cursor down, for example
            (although that doesn't work in the first line of the file).

            --
            Have you heard about the new Barbie doll? It's called Divorce
            Barbie. It comes with all of Ken's stuff.

            /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
            /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
            \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
            \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
          • Bram Moolenaar
            ... Problem is that quite often small changes to a short line do have a different column. For example pppp or xxxx at the end of the line. Perhaps the
            Message 5 of 14 , Mar 1, 2004
            • 0 Attachment
              Benjamin Peterson wrote:

              > To me personally, it would be more useful to remember the change if
              > either line or column is different. This is because I often make
              > changes to large data files that have very long lines (csv files), and
              > there may be several unrelated changes far apart on the same line.

              Problem is that quite often small changes to a short line do have a
              different column. For example "pppp" or "xxxx" at the end of the line.

              Perhaps the difference in column must be 100 or so? That is
              sufficiently large to make it worth remembering the position. Could use
              'columns' to avoid using an arbitrary number (or adding yet another
              option).

              > While I am asking for things, I would also like to suggest this:
              >
              > Can we have some way to access the changes in the undo list freely, as
              > well as just their locations? For instance, often I come upon a word
              > that needs changing and I know I have just made a similar change, but
              > there is no way to automatically reapply the change at a new location,
              > so I have to type cwNewWord<cr> again. If the changes stored in the
              > undo list could be pulled out and used at new locations, that would make
              > editing much easier for many kinds of files.

              The undo list stores whole lines, thus it would be difficult to extract
              a word from it.

              This sounds more like you want to get something from the redo buffer.
              It only stores the last redo-able command though. There have been
              suggestions to remember more commands, but the UI to get to them isn't
              that easy.

              --
              DEAD PERSON: I don't want to go in the cart!
              CUSTOMER: Oh, don't be such a baby.
              MORTICIAN: I can't take him...
              DEAD PERSON: I feel fine!
              CUSTOMER: Oh, do us a favor...
              MORTICIAN: I can't.
              The Quest for the Holy Grail (Monty Python)

              /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
              /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
              \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
              \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
            • GI
              ... Well actually I always felt similarly about yanking / undo. For instance, doing xxxxxx and then undoing undoes each x every time. More annoyingly it
              Message 6 of 14 , Mar 1, 2004
              • 0 Attachment
                On Mon, Mar 01, 2004 at 03:43:38PM +0100, Bram Moolenaar wrote:

                > After using "g," for a while, I get annoyed that a position is
                > remembered for every change. Doing "xxxxxx" creates six positions.

                Well actually I always felt similarly about yanking / undo. For
                instance, doing "xxxxxx" and then undoing undoes each "x" every time.
                More annoyingly it eats up the contents of my precious numbered
                registers, and fills it with single letters. Grrrrr.

                If you're thinking of changing the g, and g; features, I think it would
                be *super* good if you could also change it so that changes like
                "xxxxxx" get grouped in the undo history (and stop eating all my
                precious numbered registers). Maybe group them in groups of a certain
                specified number (specified with a vim option) ONLY if they are applied
                consecutively at the same place, in which case they all get undone
                together, and occupy only ONE numbered register.

                I'd go so far as saying that 'dw' and 'dd' actions should be grouped
                similarly. Any action repeated consecutively less than a specified
                number of times should be grouped for undo's and yanks ...

                But that might be too difficult to implement, and you others might not
                like it. Just my two cents ;)

                GI
              • Benjamin Peterson
                ... and ... Perhaps checking whether the columns are adjacent would get rid of the xxxx case? ... use ... &columns/2 might be a reasonable approximation. ...
                Message 7 of 14 , Mar 1, 2004
                • 0 Attachment
                  >> To me personally, it would be more useful to remember the change if
                  >> either line or column is different. This is because I often make
                  >> changes to large data files that have very long lines (csv files),
                  and
                  >> there may be several unrelated changes far apart on the same line.
                  >
                  >Problem is that quite often small changes to a short line do have a
                  >different column. For example "pppp" or "xxxx" at the end of the line.

                  Perhaps checking whether the columns are adjacent would get rid of the
                  xxxx case?

                  >Perhaps the difference in column must be 100 or so? That is
                  >sufficiently large to make it worth remembering the position. Could
                  use
                  >'columns' to avoid using an arbitrary number (or adding yet another
                  >option).

                  &columns/2 might be a reasonable approximation.

                  >The undo list stores whole lines, thus it would be difficult to extract
                  > word from it.
                  >
                  >This sounds more like you want to get something from the redo buffer.
                  >It only stores the last redo-able command though. There have been
                  >suggestions to remember more commands, but the UI to get to them isn't
                  >that easy.

                  Hm, I see. I was hoping that undo/redo could be used to implement
                  functionality like the 'add a method to repeat a previous change ("c.",
                  "d.", etc.)' entry in the poll. That would be a very useful thing to
                  have -- the + and - keys aren't doing much at the moment.

                  Syntax:

                  -ccwVermeer^M changes a word to 'Vermeer' and stores the change in
                  change register c

                  +c changes the word under the cursor to 'Vermeer'

                  +0 performs the last change (at the current cursor
                  location)
                  +2 performs the last change but 2

                  :changeregisters outputs 'c cwVermeer'


                  I suppose theoretically there is no need for special 'change registers'
                  -- + and - could just access normal ones. In that case, @c could have
                  been used to execute the change.

                  I understand that this is probably not feasible what with one thing and
                  another, but I can dream.


                  Benjamin
                • Ilya Sher
                  ... Hash: SHA1 Benjamin Peterson wrote: [snip] ... The idea seams. Not sure about the keys. What if it would be done with regular regsiters? I mean now
                  Message 8 of 14 , Mar 1, 2004
                  • 0 Attachment
                    -----BEGIN PGP SIGNED MESSAGE-----
                    Hash: SHA1

                    Benjamin Peterson wrote:
                    [snip]
                    | Syntax:
                    |
                    | -ccwVermeer^M changes a word to 'Vermeer' and stores the change in
                    | change register c
                    |
                    | +c changes the word under the cursor to 'Vermeer'
                    The idea seams.
                    Not sure about the keys.
                    What if it would be done with regular regsiters?
                    I mean now registers can contain text and macros.
                    Why shouldn't they contain changes (hmm.. they
                    are kind of macros here anyway) ?..
                    Wait ... that's what q goes for ...
                    I'm confused a little...
                    Maybe just do the '.' history and ability to move
                    it to register or something ?
                    -----BEGIN PGP SIGNATURE-----
                    Version: GnuPG v1.2.4 (GNU/Linux)
                    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

                    iD8DBQFAQ3utKQCqGJKGZm4RAqY0AKCERWeiYNYg3x3amkBHMJrivbXqJwCgsflI
                    iedNB8ihyQ3qzE3xqkLOAKg=
                    =MItF
                    -----END PGP SIGNATURE-----
                  • Benji Fisher
                    ... If it worked the way you suggest, I can see kicking myself after deleting one character too many: xxxxxxuxxxxx . Ugh! Do the problems you mention bother
                    Message 9 of 14 , Mar 1, 2004
                    • 0 Attachment
                      On Mon, Mar 01, 2004 at 11:12:31AM -0600, GI wrote:
                      > On Mon, Mar 01, 2004 at 03:43:38PM +0100, Bram Moolenaar wrote:
                      >
                      > > After using "g," for a while, I get annoyed that a position is
                      > > remembered for every change. Doing "xxxxxx" creates six positions.
                      >
                      > Well actually I always felt similarly about yanking / undo. For
                      > instance, doing "xxxxxx" and then undoing undoes each "x" every time.
                      > More annoyingly it eats up the contents of my precious numbered
                      > registers, and fills it with single letters. Grrrrr.
                      >
                      > If you're thinking of changing the g, and g; features, I think it would
                      > be *super* good if you could also change it so that changes like
                      > "xxxxxx" get grouped in the undo history (and stop eating all my
                      > precious numbered registers). Maybe group them in groups of a certain
                      > specified number (specified with a vim option) ONLY if they are applied
                      > consecutively at the same place, in which case they all get undone
                      > together, and occupy only ONE numbered register.
                      >
                      > I'd go so far as saying that 'dw' and 'dd' actions should be grouped
                      > similarly. Any action repeated consecutively less than a specified
                      > number of times should be grouped for undo's and yanks ...
                      >
                      > But that might be too difficult to implement, and you others might not
                      > like it. Just my two cents ;)

                      If it worked the way you suggest, I can see kicking myself after
                      deleting one character too many: "xxxxxxuxxxxx". Ugh!

                      Do the problems you mention bother you enough to train yourself to
                      use vim slightly differently? If so, consider learning to use Visual
                      mode for things like this. Instead of "xxxxx", use "vllllx", for
                      example. Yes, that is one more character to type, but when you start
                      using other motions (w, e, f, t, ...) you will end up using fewer key
                      strokes in most cases.

                      HTH --Benji Fisher
                    • Bram Moolenaar
                      ... This sounds very much like recording: qccwVermeer q record into register c @c replay register c ... We can t change the meaning of - and +
                      Message 10 of 14 , Mar 1, 2004
                      • 0 Attachment
                        Benjamin Peterson wrote:

                        > >The undo list stores whole lines, thus it would be difficult to extract
                        > > word from it.
                        > >
                        > >This sounds more like you want to get something from the redo buffer.
                        > >It only stores the last redo-able command though. There have been
                        > >suggestions to remember more commands, but the UI to get to them isn't
                        > >that easy.
                        >
                        > Hm, I see. I was hoping that undo/redo could be used to implement
                        > functionality like the 'add a method to repeat a previous change ("c.",
                        > "d.", etc.)' entry in the poll. That would be a very useful thing to
                        > have -- the + and - keys aren't doing much at the moment.
                        >
                        > Syntax:
                        >
                        > -ccwVermeer^M changes a word to 'Vermeer' and stores the change in
                        > change register c
                        >
                        > +c changes the word under the cursor to 'Vermeer'

                        This sounds very much like recording:

                        qccwVermeer<Esc>q record into register c
                        @c replay register c

                        > +0 performs the last change (at the current cursor
                        > location)
                        > +2 performs the last change but 2

                        We can't change the meaning of "-" and "+" without being incompatible.
                        Repeating a previous change, without indicating it should be remembered
                        when you do it, is in the todo list with "c." and "c3.".

                        --
                        ARTHUR: Well, I can't just call you `Man'.
                        DENNIS: Well, you could say `Dennis'.
                        ARTHUR: Well, I didn't know you were called `Dennis.'
                        DENNIS: Well, you didn't bother to find out, did you?
                        The Quest for the Holy Grail (Monty Python)

                        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                        /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                        \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
                        \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
                      • Bram Moolenaar
                        ... The problem is that you can t predict when you want xxxxx to be undone as a whole and when you only want to undo the last x . Even a setting to specify
                        Message 11 of 14 , Mar 1, 2004
                        • 0 Attachment
                          Gautam wrote:

                          > On Mon, Mar 01, 2004 at 03:43:38PM +0100, Bram Moolenaar wrote:
                          >
                          > > After using "g," for a while, I get annoyed that a position is
                          > > remembered for every change. Doing "xxxxxx" creates six positions.
                          >
                          > Well actually I always felt similarly about yanking / undo. For
                          > instance, doing "xxxxxx" and then undoing undoes each "x" every time.
                          > More annoyingly it eats up the contents of my precious numbered
                          > registers, and fills it with single letters. Grrrrr.
                          >
                          > If you're thinking of changing the g, and g; features, I think it would
                          > be *super* good if you could also change it so that changes like
                          > "xxxxxx" get grouped in the undo history (and stop eating all my
                          > precious numbered registers). Maybe group them in groups of a certain
                          > specified number (specified with a vim option) ONLY if they are applied
                          > consecutively at the same place, in which case they all get undone
                          > together, and occupy only ONE numbered register.
                          >
                          > I'd go so far as saying that 'dw' and 'dd' actions should be grouped
                          > similarly. Any action repeated consecutively less than a specified
                          > number of times should be grouped for undo's and yanks ...

                          The problem is that you can't predict when you want "xxxxx" to be undone
                          as a whole and when you only want to undo the last "x". Even a setting
                          to specify this would not be sufficient, it depends on what you are
                          doing. You can always use "5u" to undo this, although you need to know
                          the number of changes then.

                          For the registers it's the same thing: How can Vim know that you want to
                          put five characters instead of one? And when doing "jxjxjxjxjx" you get
                          the same problem, thus it could only be changed for specific situations
                          anyway. If you need to keep old deletions you can put them in a named
                          register.

                          --
                          [clop clop]
                          ARTHUR: Old woman!
                          DENNIS: Man!
                          ARTHUR: Man, sorry. What knight lives in that castle over there?
                          DENNIS: I'm thirty seven.
                          ARTHUR: What?
                          DENNIS: I'm thirty seven -- I'm not old!
                          The Quest for the Holy Grail (Monty Python)

                          /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                          /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                          \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
                          \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
                        • GI
                          ... Hmm. I see your point. Plus as you rightly pointed out, prepending a v to operations you want to club will sovle this problem, making this feature
                          Message 12 of 14 , Mar 1, 2004
                          • 0 Attachment
                            On Mon, Mar 01, 2004 at 01:32:32PM -0500, Benji Fisher wrote:

                            > On Mon, Mar 01, 2004 at 11:12:31AM -0600, GI wrote:
                            >
                            > > On Mon, Mar 01, 2004 at 03:43:38PM +0100, Bram Moolenaar wrote:
                            > >
                            > > > After using "g," for a while, I get annoyed that a position is
                            > > > remembered for every change. Doing "xxxxxx" creates six
                            > > > positions.
                            > >
                            > > Well actually I always felt similarly about yanking / undo. For
                            > > instance, doing "xxxxxx" and then undoing undoes each "x" every
                            > > time. More annoyingly it eats up the contents of my precious
                            > > numbered registers, and fills it with single letters. Grrrrr.
                            > >
                            > > If you're thinking of changing the g, and g; features, I think it
                            > > would be *super* good if you could also change it so that changes
                            > > like "xxxxxx" get grouped in the undo history (and stop eating all
                            > > my precious numbered registers). Maybe group them in groups of a
                            > > certain specified number (specified with a vim option) ONLY if they
                            > > are applied consecutively at the same place, in which case they all
                            > > get undone together, and occupy only ONE numbered register.
                            > >
                            > > I'd go so far as saying that 'dw' and 'dd' actions should be grouped
                            > > similarly. Any action repeated consecutively less than a specified
                            > > number of times should be grouped for undo's and yanks ...
                            > >
                            > > But that might be too difficult to implement, and you others might
                            > > not like it. Just my two cents ;)
                            >
                            > If it worked the way you suggest, I can see kicking myself after
                            > deleting one character too many: "xxxxxxuxxxxx". Ugh!

                            Hmm. I see your point. Plus as you rightly pointed out, prepending a 'v'
                            to operations you want to club will sovle this problem, making this
                            feature unnecessary! Aside from the other problems listed in Bram's
                            email.

                            Thanks for the responces!

                            GI
                          • Keith Roberts
                            ... I hate to bring up the dreaded e word :) but IIRC emacs groups contiguous changes together, which I think would work nicely here. That is, in the
                            Message 13 of 14 , Mar 23, 2004
                            • 0 Attachment
                              >-----Original Message-----
                              >From: GI [mailto:gautam@...]
                              >Sent: Monday, March 01, 2004 9:13 AM
                              >To: vim-dev@...
                              >Subject: Re: modification for patch 6.2.298
                              >
                              >On Mon, Mar 01, 2004 at 03:43:38PM +0100, Bram Moolenaar wrote:
                              >
                              >> After using "g," for a while, I get annoyed that a position is
                              >> remembered for every change. Doing "xxxxxx" creates six positions.
                              >
                              >Well actually I always felt similarly about yanking / undo.
                              >For instance, doing "xxxxxx" and then undoing undoes each "x"
                              >every time.
                              >More annoyingly it eats up the contents of my precious
                              >numbered registers, and fills it with single letters. Grrrrr.
                              >
                              >If you're thinking of changing the g, and g; features, I think
                              >it would be *super* good if you could also change it so that
                              >changes like "xxxxxx" get grouped in the undo history (and
                              >stop eating all my precious numbered registers). Maybe group
                              >them in groups of a certain specified number (specified with a
                              >vim option) ONLY if they are applied consecutively at the same
                              >place, in which case they all get undone together, and occupy
                              >only ONE numbered register.
                              >
                              >I'd go so far as saying that 'dw' and 'dd' actions should be
                              >grouped similarly. Any action repeated consecutively less than
                              >a specified number of times should be grouped for undo's and yanks ...
                              >
                              >But that might be too difficult to implement, and you others
                              >might not like it. Just my two cents ;)

                              I hate to bring up the dreaded 'e' word :) but IIRC emacs groups
                              'contiguous' changes together, which I think would work nicely here.
                              That is, in the sentence, "Now is the time for all good ...", with the
                              cursor at 'm' in 'time', xxx<bs><bs><bs>dw would result in 'the time for
                              ' being deleted (and could be stored together in the "0 register, since
                              the deletions are contiguous). Something to think about, anyway.

                              Also, I don't see any reason why you shouldn't be able to undo the same
                              changes in Normal mode as you can in Insert mode. Obviously those
                              changes are individually addressable while in Insert mode, because
                              CTRL-U undoes them individually. Why couldn't that separation be
                              maintained when Insert mode is left, and CTRL-U used (in Normal mode)
                              the same as in Insert mode, while 'u' operates as it does now?
                            • Bram Moolenaar
                              ... I don t get it. The xxx deletes me , leaving tifor . The backspaces move the cursor and then dw deletes the space before tifor . ... Don t
                              Message 14 of 14 , Mar 23, 2004
                              • 0 Attachment
                                Keith Roberts wrote:

                                > I hate to bring up the dreaded 'e' word :) but IIRC emacs groups
                                > 'contiguous' changes together, which I think would work nicely here.
                                > That is, in the sentence, "Now is the time for all good ...", with the
                                > cursor at 'm' in 'time', xxx<bs><bs><bs>dw would result in 'the time for
                                > ' being deleted (and could be stored together in the "0 register, since
                                > the deletions are contiguous). Something to think about, anyway.

                                I don't get it. The "xxx" deletes "me ", leaving "tifor". The
                                backspaces move the cursor and then "dw" deletes the space before
                                "tifor".

                                > Also, I don't see any reason why you shouldn't be able to undo the same
                                > changes in Normal mode as you can in Insert mode. Obviously those
                                > changes are individually addressable while in Insert mode, because
                                > CTRL-U undoes them individually. Why couldn't that separation be
                                > maintained when Insert mode is left, and CTRL-U used (in Normal mode)
                                > the same as in Insert mode, while 'u' operates as it does now?

                                Don't understand this either. CTRL-U in Insert mode deletes all
                                characters in the line. I Normal mode it scrolls.

                                Remember that Vim users know the current behavior, thus any changes in
                                undo causes backwards compatibility problems.

                                Breaking undo in Insert mode is a known request. You can type "CTRL-G
                                u" to start a new undo sequence, but something more automatic is
                                desired. It should be simple to implement something, but it's difficult
                                to implement a really good solution.

                                --
                                The difference between theory and practice, is that in theory, there
                                is no difference between theory and practice.

                                /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                                /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                                \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
                                \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
                              Your message has been successfully submitted and would be delivered to recipients shortly.