Let's say I do multi-file replace like 'argdo %s/foo/bar/g',
and I 'autowrite' and 'nohidden' options are  set.
So the argdo will replace and write files, because of 'autowrite' is on.
My question is, is there any trick to do 'undo' after that that
would undo all changed files in this situation ?

I think given those conditions (autowrite and nohidden), there seems to be no such way from my experimenting. However, if you switch to using hidden instead of nohidden, you can do

        :argdo u

which will undo the last action in each argument. I prefer to use hidden and then, if I like the changes that went through, issue a ":wall" to write the changed files. This allows the undo as well as allowing me to proof that all the changes went through as expected. If you set 'autowriteall' in addition to 'hidden', you can get some of the benefits of 'autowrite' but still have the recovery options of 'hidden'.

Just a few ideas...

-tim




Reply via email to