Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Close the current tab with a keyboard shortcut

I see that in Tools -> Options -> Keyboard you can set Keyboard shortcuts for a large number of tasks. I tried searching for "Close" and these are the results, amongst a few others:

  • File.Close
  • File.CloseAllButThis
  • File.CloseProject
  • File.CloseSolution

If I set File.Close to be Ctrl+W (Honestly, why doesn't Microsoft innately support such a universal shortcut is beyond me) it mostly works, however if I have both the code-behind and the Designer view open for a form, it closes both tabs. Should I be setting a different command, or am I stuck with this? It's a small inconvenience, but it really irritates me.

like image 406
sab669 Avatar asked Oct 16 '13 15:10

sab669


1 Answers

I don't know if it's the same in VS2010, but in VS2012 this command is called "Window.CloseDocumentWindow" and it is mapped to Ctrl+F4 by default, to mirror Alt+F4 for closing application-level windows.

I believe the Ctrl+W shortcut was first brought to Microsoft Windows by Adobe Photoshop, a carry-over from Apple OS X, where Adobe seems to have remapped all of the ⌘ command+* shortcuts to Ctrl+*. On OS X, ⌘ command+W only closes windows, but the application stays resident. One uses ⌘ command+Q to quit applications, instead. As the window is the application in Windows, Ctrl+W is kind of a misnomer, but it has gotten more popular for some applications like web browsers to support it.

Given the market dominance of MS Windows over Apple OS X for desktop operating systems, it would seem that the F4-style shortcuts are "more universal" than the W/Q ones.

like image 179
moron4hire Avatar answered Oct 05 '22 18:10

moron4hire