Share via


Mapping keyboard shortcuts (like ESC to close a work item)

If you are a regular user of Visual Studio, you may already know this. But I didn't for a while, and am now taking advantage of it.

VS allows you to map keys to any number of commands, including Team Foundation Server commands.

To do this, Select "Tools | Options", then expand "Environment" and select Keyboard.

If you want to map the "ESC" key to close a work item, then first enter "CloseDocumentWindow" in "Show commands containing". This will filter all the commands to those containing that text. (There will only be one).

You will see that "Control-F4" is the currently assigned key to close a document window. I really don't like that, I like ESC.

Then put the cursor in the "Press shortcut keys" text box. Now press the ESC key. You will see ESC appear. Now press the Assign button, and that key is now mapped.

You will see a listbox: "Use new shortcut in:", which probably defaults to "Global". This is the context of the new keyboard shortcut. "Global" means the key will work no matter where you are at (code editor, debugger) in VS.

If you want to map a key within the context of a Work Item Tracking window, there are three contexts to select from that "Use new shortcut in:" listbox:

* Work Item Editor

* Work Item Query View

* Work Item Results View

If you select those contexts (instead of Global), then the mapped key will only be effective within that context. For example, you may want ESC to only close "Work Item Editor" windows.

Anyway, I like it and it works well for me. Let me know what you think.

Comments

  • Anonymous
    March 02, 2007
    Buck Hodges on Schema for the WorkspaceMapping.xml file. Michael Ruminer on TFS Event Subscription...

  • Anonymous
    March 14, 2007
    You should check out SlickEdit's Command Spy.  It listens for any command that gets executed and logs it.  It's great for finding out what command gets run when, for instance, a toolbar button or a menu item are clicked.  Then, when you know the command name, you can bind a key to it.  It also lets you sort by the number of times you run that command, so you can see which commands you run the most.  Oh yeah, it's free, too! www.slickedit.com/gadgets