Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to empty Visual Studio editor undo buffers?

Is there a button or a command somewhere that would let me empty completely the undo buffers used by Visual Studio editor?

I would like to empty these buffers when I do a check-in or just before I begin an important change.

My problem: I keep some solutions open permanently (I mean, for days) and many files are pinned. After a week of dev and refactoring, the undo buffers for these files are pretty large. If I do some changes in 4 files and decide to undo them using CTRL+Z, I have to be careful to not go back too far.

Typical case: I hit CTRL+Z many times in one file, but one or two changes were global renaming of a method. Visual Studio stalls for two seconds undoing these changes, making you think that the change undone was a simple section opening/closing at the end of the file. So you continue hitting CTRL+Z until something happens and then suddenly, you're back at the monday version of the file.

This is not critical since I check in my changes very often, but it is annoying.

I'm using Visual Studio Pro 2019.

Thanks.

like image 761
Sylvain Rodrigue Avatar asked Oct 24 '25 19:10

Sylvain Rodrigue


1 Answers

There's a command called Window.RestoreClosedTab which will reopen documents in the reverse order they were closed (last to close, first to open). You could close all the documents for which you want to clear the undo buffers, then invoke this command to reopen the files you want.

On my settings, the default keybinding is Ctrl+Z + Ctrl+K, or you can rebind it in the Tools -> Options -> Environment -> Keyboard settings.

like image 175
Jimmy Avatar answered Oct 26 '25 12:10

Jimmy