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

Reply via email to