Re: Clearing undo history after a file write
Max Dyckhoff wrote: That's strange, my marks are maintained when I do an reload the buffer with :e, and the jumplist seems to be preserved, too. I never use either mechanism, but a little experiment shows they are still there. Perhaps there are other things that are erased too though, a side-effect I hadn't thought of. Perhaps it is something to do with my vimrc; I am pretty keen on keeping things around for as long as possible (:set hidden, :set history=1000, etc) Max Marks are remembered in the viminfo: local marks according to 'nn (nn = number of files) which must be included whenever 'viminfo' is nonempty, and global marks according to f (default=all, fn [n != 0] =all, f0 = none). Best regards, Tony. -- The assertion that "all men are created equal" was of no practical use in effecting our separation from Great Britain and it was placed in the Declaration not for that, but for future use. -- Abraham Lincoln
Re: Clearing undo history after a file write
That's strange, my marks are maintained when I do an reload the buffer with :e, and the jumplist seems to be preserved, too. I never use either mechanism, but a little experiment shows they are still there. Perhaps there are other things that are erased too though, a side-effect I hadn't thought of. Ah...I do see some persistance of these things depending on where the marks were in the file. I tested the following in a 100 line file (with "vi -u NONE"): :1,30d :3 :ka :e! :'a It doesn't return to the line I marked previously (originally line 33), but to line 3 of the previous file. Semi-understandable...just a somewhat peculiar behavior when :1,30d :3 :ka :u :'a does return to the proper spot. It seems to sorta keep the marks. Similar oddities seem to happen with jumps. Perhaps it is something to do with my vimrc; I am pretty keen on keeping things around for as long as possible (:set hidden, :set history=1000, etc) I'm somewhere in between...I like long histories, but only set 'hidden' as needed as a reminder to myself. I also don't let .viminfo handle much, as I like to have a fairly fresh copy of vim each time I start it.
RE: Clearing undo history after a file write
That's strange, my marks are maintained when I do an reload the buffer with :e, and the jumplist seems to be preserved, too. I never use either mechanism, but a little experiment shows they are still there. Perhaps there are other things that are erased too though, a side-effect I hadn't thought of. Perhaps it is something to do with my vimrc; I am pretty keen on keeping things around for as long as possible (:set hidden, :set history=1000, etc) Max > -Original Message- > From: Tim Chase [mailto:[EMAIL PROTECTED] > Sent: Monday, February 05, 2007 10:04 AM > To: Phil Edwards > Cc: Max Dyckhoff; vim@vim.org > Subject: Re: Clearing undo history after a file write > > >> The easiest thing to do would probably just to do :e after > >> your :w. :e will re-read the file, wiping the undo buffer. > > > > Ah, didn't know about that side effect. I knew there had to > > be an easier solution. :-) Thanks! > > Max is correct (and it is quite easy), though just be aware that > there are some other side effects that go with that > method...particularly marks and your jumplist for the given file > will also go up in smoke in the same way as your undo history. > > You may or may not want that effect. But every alternative way > of clearing the undo history that I've thought of has also > cleared these items as well so it's just tough luck. :) > > -tim > > > > > > >
Re: Clearing undo history after a file write
The easiest thing to do would probably just to do :e after your :w. :e will re-read the file, wiping the undo buffer. Ah, didn't know about that side effect. I knew there had to be an easier solution. :-) Thanks! Max is correct (and it is quite easy), though just be aware that there are some other side effects that go with that method...particularly marks and your jumplist for the given file will also go up in smoke in the same way as your undo history. You may or may not want that effect. But every alternative way of clearing the undo history that I've thought of has also cleared these items as well so it's just tough luck. :) -tim
Re: Clearing undo history after a file write
On 2/5/07, Max Dyckhoff <[EMAIL PROTECTED]> wrote: The easiest thing to do would probably just to do :e after your :w. :e will re-read the file, wiping the undo buffer. Ah, didn't know about that side effect. I knew there had to be an easier solution. :-) Thanks! phil
RE: Clearing undo history after a file write
The easiest thing to do would probably just to do :e after your :w. :e will re-read the file, wiping the undo buffer. Max > -Original Message- > From: Phil Edwards [mailto:[EMAIL PROTECTED] > Sent: Monday, February 05, 2007 9:26 AM > To: vim@vim.org > Subject: Clearing undo history after a file write > > After writing out a file, I would (sometimes, not always) like to > prevent 'u' from undoing past the :w into old changes, e.g., > > - change #1 > - change #2 > - :w > - change #3 > - change #4 > - 'u' undoes #4 and then #3, but then stops > > This seems like such a simple thing, but to my surprise it's less > trivial than I thought it would be. > > The only thing in ":help undo" and its related tags which seems to be > relevant is the undolevels variable. So maybe something like > > - copy undolevels into some temp variable // I don't remember the > "let" syntax offhand > - set undolevels=-1 > - set undolevels=temp_holding_variable > > would work? A value of -1 disables undo altogether, so would this > sequence kill the history and start it from scratch? > > > -phil