9

How can I add custom commands to the keyboard dialog (Tools->Options->Keyboard) in order to trigger them by shortcuts? Unfortunately, I could not find any resource on the web.

I crossed this blog post, but it's slightly different, because I'd have to create a menu entry. I only want to show the commands in the keyboard dialog. Just like it worked with macros.

Matthias
  • 14,822
  • 5
  • 36
  • 78
  • What about http://stackoverflow.com/tags/vsx/info? – John Saunders Sep 18 '12 at 18:16
  • @JohnSaunders: what do you mean? – Matthias Sep 18 '12 at 18:18
  • Sorry, I thought there were some links there. I'll have to add some. – John Saunders Sep 18 '12 at 18:24
  • As of 2010, see http://stackoverflow.com/questions/1146776/visual-studio-2010-addin-writing-articles-tutorials/1146787#1146787. There isn't that much different in this area in 2012. – John Saunders Sep 18 '12 at 18:25
  • @JohnSaunders: Thanks for the link. I already managed to add a menu entry. Nevertheless, I couldn't find any appropriate way to add ONLY a command. Notice that this is just to migrate some macros (VS2010) to a vsx package (VS2012), because VS2012 doesn't support macros any longer. I don't want to waste much time on this, so it would be very kind, if someone could point me to a good blog post or something. – Matthias Sep 18 '12 at 18:32

1 Answers1

4

I have not checked VS 2012 in this area, but I think it's the same as for previous version.

All that menu and command stuff is localized in a file called [mypackage].vsct which is the Visual Studio Command Table. The schema is described here: VSCT XML Schema Reference. When you used the wizard it probably created one for you.

As you can see in the schema, a Command is always linked somehow to a Menu (Commands Element), but there are a number of flags you can use to tweak this: Command Flag Element. Depending on what you do, I'd try the CommandWellOnly, DefaultInvisible and DynamicVisibility.

Anyway, if you don't want your menu to appear on the top menu bar, just can also just change the <Parent> element of the root <Menu> element in the vsct file.

Simon Mourier
  • 117,251
  • 17
  • 221
  • 269