Bram: Any explanation for that? - Re: How can I force no undo during a function call?
- Mario Schweigler wrote:
> The thing is that it works sometimes, but not always, depending onIt's not so mysterious: changing 'undolevels' only has effect for the
> whether I have changed the text before calling the function. Just as you
> described it, it works fine, but if you change something in the text
> before calling the function, sometimes (depending on WHERE in the text I
> change something) it does not work. In this case, "u" would undo
> everything the function did PLUS the last change before the function.
next thing being saved for undo. If you are performing a sequence of
commands without typing, this is counted as one undo-able action. You
can't really switch off undo halfway. However, if you attempt undoing
halfway the action, this counts as restarting undo and then the value of
'undolevels' is checked. But since you don't really want to undo
anything you make it complicated to get back what you want.
Best is if you can set 'undolevels' to -1 before making any change.
Changing 'undolevels' halfway a change has unpredictable results.
From "know your smileys":
:q vi user saying, "How do I get out of this damn emacs editor?"
/// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
/// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\
\\\ Project leader for A-A-P -- http://www.a-a-p.org ///
\\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///