Skip to content

Instantly share code, notes, and snippets.

@jpoehls
Created March 13, 2012 19:02
Show Gist options
  • Save jpoehls/2030795 to your computer and use it in GitHub Desktop.
Save jpoehls/2030795 to your computer and use it in GitHub Desktop.
Using CTRL+W to close tabs in Visual Studio

In Tools | Options | Keyboard...

  1. Add CTRL+W as a Global shortcut for Window.CloseDocumentWindow
  2. Remove the CTRL+W shortcut for Edit.SelectCurrentWord

The caveat to this is if you are used to using CTRL+W to select the current word. If you do, find another shortcut that works for that.

@vertisan
Copy link

vertisan commented Sep 2, 2019

In my VS Code it was command: workbench.action.closeActiveEditor (Linux)

@kintax
Copy link

kintax commented Sep 5, 2019

thank you! every time i install VS i forget this and i choose File.Close instead... hair-tearer for sure!

@DBJDBJ
Copy link

DBJDBJ commented Jan 5, 2020

Imagine the organization which can not assign "CTRL+W" to close the window in their flagship development product for a decade or more. Actually much more than a decade. This is not a snarky comment. I am just amazed users need an non-trivial community effort to solve that.

@Burgyn
Copy link

Burgyn commented Apr 1, 2020

thanks

@MarioBinder
Copy link

Thanks

@joseprofe
Copy link

Godlike

@panospd
Copy link

panospd commented Jun 16, 2021

The 2nd bullet did the magic! thanks

@Kev-in123
Copy link

Thank you! :)

@akunaatrium
Copy link

First thanks from 2022!

@DanCaprine
Copy link

Thanks!

@ugurozturk
Copy link

Thanks

@TheNotary
Copy link

Thanks

@domingoladron
Copy link

For those on Resharper, it appears Ctrl+W is used by a couple commands. In order to get Ctrl+W to close a window, you have to clear the Resharper keyboard settings first.

vs-resharper-ctrl-w

@ricardoschwarz
Copy link

thank you

@Nereare
Copy link

Nereare commented Nov 19, 2022

Thank you so much! ❤️

@LaurentBartkowski
Copy link

Thank you !

@niuage
Copy link

niuage commented Mar 3, 2024

Still useful to this day :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment