Since the text editor is inside the window you’re closing, the CTRL+W does the “inner most” action…selecting a word. The result is that SSMS has to choose which action to take. The choice is going to be based on scope. If you stop after step 2, CTRL+W is assigned to both the select a word, and close tab actions. In the Customize dialog box, click Close. In the Name box on the shortcut menu, type a name for the toolbar button with an ampersand (&) before the letter that you want as the keyboard accelerator. Now, both CTRL+W and CTRL+F4 work to close your query tab! In the Customize dialog box, on the Commands tab, click Modify Selection. Select the option for “CTRL+W (Text Editor)” and click “Remove”.
From the “Shortcuts for selected command” drop-down, you’ll see two items here (assuming you have the out of the box defaults).Select “Edit.SelectCurrentWord” from the list.Notice that the “Shortcut currently used by:” drop-down shows that CTRL+W is in use by Edit.SelectCurrentWord. Put your cursor in the “Press shortcut keys” text box, type CTRL+W (or whatever else you want), then click “Assign”.You can type a partial match into the text box to find the item you want. Select “Window.CloseDocumentWindow” from the list.On the navigation tree, go to Environment–>Keyboard–>Keyboard: Keyboard shortcuts can be mapped in the SSMS Options window. If you are willing to sacrifice the “Select current word” default behavior that is tied to CTRL+W, you can re-assign that keystroke to close the query window. If you can switch your muscle memory away from CTRL+W to CTRL+F4, you can use that shortcut pretty much everywhere.īut you really want to use CTRL+W (or something else) Also, note that CTRL+F4 is a pretty universal shortcut that works to close tabs/windows in other applications, too–including your favorite web browser. Huzzah! This will close your query tab! Easy as pie. This is still a nice shortcut, but it won’t help you close any windows. Instead, CTRL+W will select the word at the cursor’s current position. Muscle memory be damned, CTRL+W doesn’t close the current tab in SSMS. In all major web browsers, CTRL+W will close your current tab. Always be closing windows when not in use. None of these are groundbreaking super-secret features–they are the little things that I do as part of my daily work that make me more efficient.
#Sql server management studio shortcut series
This series of short posts will demonstrate some lesser-known features, keyboard shortcuts, and other tips that make my day as a DBA more productive.