> echo "first file" > first.txt > echo "second file" > second.txt > gvim first.txt second.txt > > Suppose in first.txt I edit `first` to become `1st` using Vim editing > commands: > > cw1st<Escape> > > Now I perform a search-and-replace to change `second` to `2nd`: > > :argdo %s/second/2nd/ge > > > Now I try to undo my most recent replace operation: > > :argdo u > > I'd like this to undo only the change(s) made by the s/// command, but > it also changes `1st` back to `first`. > > I've tried saving all buffers before doing the replace operation, but > `:argdo u` undoes past the save (which generally pleases me greatly, but > is unfortunate in this case :-)).
If saving a snapshot of your buffers in a "good" state (using ":wall") before monkeying with argdo is acceptable (which by your comments, it is), you should be able to revert to the saved copy with something like: :wall :argdo %s/foo/bar/g [whoops! I meant "s/\<foo\>/bar"!] :argdo e! :argdo %s/\<foo\>/bar/g where "argdo e!" abandons any changes you've made and reloads the file. -tim