25

I often run tests and need the test-result pane to be pinned. In other time, I mostly work with writting codes and compile - I prefer to have the output pane (which shared the same space with test-result pane) automatically viewed while compiling and collapsed when done (i.e. unpinned).

I need an hotkey to quickly switch the pane to pinned/unpinned state. How can I do that?

Nam G VU
  • 33,193
  • 69
  • 233
  • 372

3 Answers3

33

Check out this post on Visual Studio 2010 - Keyboard Shortcuts

  1. Select the Output windows with CTRL+ALT+O
  2. Pin the Output with ALT+W+K
  3. Auto hide the Output with ALT+W+A
KyleMit
  • 30,350
  • 66
  • 462
  • 664
nithins
  • 3,172
  • 19
  • 21
  • I like the simplicity, but it's not really a hotkey for the command (you're accessing the command from the menu). – jamiebarrow Aug 23 '12 at 13:06
  • 3
    In VS 2012, Alt-W, k is Dock, which is related but not quite the same as pin. There's Alt-W, p, for Pin Tab, which is not working for me at the moment. And the tooltip for the pushpin icon is "Auto-hide". @jamiebarrow I consider it a hotkey as long as I don't need the mouse. You could customize it to a single chord if you like, and bypass the menu. – Jay Carlton Dec 05 '13 at 19:05
  • 1
    @Jay it's not working because there are two menu commands catching the 'p' letter: Split and Pin Tab. Alt-W, p, p, Enter should work - but I guess you can hardly call it a "shortcut" ;) – Igor Brejc Jan 15 '15 at 16:36
  • Another option is to use alt+- to access the menu of the current active window (Visual studio 2015) – Kedde Dec 08 '15 at 12:23
7

In VS 2017 you can assign your own hotkey to the command Window.PinTab, which both pins and unpins a tab.

Options > Keyboard Shortcuts

KyleMit
  • 30,350
  • 66
  • 462
  • 664
Johan Maes
  • 1,161
  • 13
  • 13
6

You can locate the commands in the options dialog (Tools -> Options -> Environment -> Keyboard), and assign whatever keyboard shortcut you want for this. However, in your case it's two commands: one for "pinning" and another for "unpinning". Another option would be to write a macro that combines the commands:

Sub DockOutputWindow()
    DTE.ExecuteCommand("View.Output")
    DTE.ExecuteCommand("Window.Dock")
End Sub

Sub AutoHideOutputWindow()
    DTE.ExecuteCommand("View.Output")
    DTE.ExecuteCommand("Window.AutoHide")
End Sub

Then you can use the keyboard options to assign shortcut keys to these macros.

Of course you can do this in an even more advanced way. Say you have the command SetCodingMode that will both dock the output windows and hide the test-result window and SetTestMode that does the opposite.

Johan Maes
  • 1,161
  • 13
  • 13
Fredrik Mörk
  • 155,851
  • 29
  • 291
  • 343