Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio: Shortcut to close window not working

Tags:

I changed the shortcut to close a window to Ctrl+W and to close all windows to Ctrl+Shift+W. Close all windows works fine, but Ctrl+W selects the word currently under the cursor but does not close the window.

When I right-click a tab it say Ctrl+W is the shortcut to close it (And also Ctrl+S to save and Ctrl+Shift+W to close all). Why is only the close window shortcut not working?

like image 606
Kackao Avatar asked Sep 23 '15 09:09

Kackao


People also ask

How do I close a window in Visual Studio?

ALT+F4. System menu | Close. Close button.

How do I close a shortcut in Visual Studio?

In Visual Studio 2019 it is Ctrl-F4 by default to CloseDocumentWindow. The action is Window.

How do I enable shortcut keys in Visual Studio?

To configure keyboard shortcuts through the JSON file, open Keyboard Shortcuts editor and select the Open Keyboard Shortcuts (JSON) button on the right of the editor title bar. This will open your keybindings.json file where you can overwrite the Default Keyboard Shortcuts.


1 Answers

In Visual Studio (VS 2015 in my case but it's similar down to VS 2010 at least) keyboard shortcuts may have a different meaning depending on the context in which they are executed.

Click Tools / Options / Environment / Keyboard to look up or define shortcuts (you already did that probably). What I called "context" is selected in the combobox labelled "Use new shortcut in:". Most likely you defined the shortcut in "Global" but you want it to work in "Text Editor". In the latter Ctrl+W selects the current word.

Redefine Ctrl+W for "Text Editor" and you should be fine.

like image 187
TobiMcNamobi Avatar answered Sep 28 '22 22:09

TobiMcNamobi