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

Re: modification for patch 6.2.298

Expand Messages
  • 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 1 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 2 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 3 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 4 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 5 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 6 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 7 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 8 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 9 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 10 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 11 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 12 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.