Tips and Tricks: Quickly Closing Documents
In VS 2010, we made a design decision to move the “X” from the right side of the Tab Well to within each tab.
Before (VS 2008)
After (VS 2010)
The majority of feedback around this change was positive, but, as with most UI changes, there has been a vocal group that preferred the older placement. When asked what they liked about the old placement, 99% of the time the response was, “I liked the ability to quickly close tabs by repeatedly clicking on the ‘X’ without moving my mouse.”
I’ll admit it: I used that feature quite a bit to quickly close tabs. That is, until I found out that there are better and more efficient ways to clean up the Tab Well. Once I discovered these, I never looked back. So, for this “Tips and Tricks” article, I wanted to share some of those ways to quickly close documents.
Under the Window menu is a handy command: Close All Documents. Clicking this will prompt you to save your work and will then close all documents that are currently open. Yes, this does affect more than just the documents in the Tab Well – floating documents are also closed. If you don’t want to take your hands off the keyboard, simply press Alt+ W, L, to invoke the command (You can also assign it a keyboard shortcut under Tools->Options->Environment->Keyboard).
Another handy shortcut is Ctrl+F4 which, on most machines, is bound to the command Window.CloseDocumentWindow. Pressing this keyboard combination will close the current document window that has focus. Therefore, if you want to quickly get rid of a number of items in your tab well, just keep pressing Ctrl+F4 and eventually they’ll be gone.
#3: Right-Click->Close All But This
If you want to close all but one open file, simply right-click on the tab and select Close All But This. This will close all open documents (floating included) except the tab you’ve right-clicked on.
#4: Middle Click
For those that prefer to use the mouse instead of the keyboard, there’s still a quick way to close tabs: the middle click. This shortcut actually works in a number of other popular applications as well. Simply place your mouse on the tab well and middle click to close the tab. You can keep your mouse in the first spot and click away.
I’m sure there are other ways to close documents, but these are some of my favorite. Hopefully you’ll find these shortcuts useful. Please add any of your favorites that I missed to the comments.
|Weston Hutchins – Program Manager, Visual Studio Shell Team
Short Bio: I started at Microsoft as an intern in 2005 and have been working in Visual Studio ever since. I’m currently a PM on the VS Shell IDE team and work on the core IDE UI and services as well as the Extension Manager and http://visualstudiogallery.com integration. Prior to my current duties, I was the SKU manager for the Visual Studio Express products.