Welcome to MSDN Blogs Sign in | Join | Help

Sara Ford's Weblog

My adventures embracing open source on CodePlex and at Microsoft

News

    • Did you know... All author proceeds go directly to sending Hurricane Katrina survivors to college.

      Microsoft Visual Studio Tips book

      Recent Entries

Did you know… How to bind keyboard shortcuts to commands

The Visual Studio shell is a big place.  I should know, since I used Visual J++ everyday for a year before joining the team.  As I write these tips, I try to think back to my J++ days to come up with a list of tips and tricks I wish I had known back then what I now take for granted.  One of these is definitely keyboard binding.  Maybe I didn’t look hard enough for features within Visual Studio.  Maybe I never needed to rebind a command, so I never discovered this.  Anyways, here’s how to do it, so everyone knows now.

  1. Go to Tools – Options and choose Environment – Keyboard
  2. Either select the command from the list or type in the command name in the edit box above it
  3. In the “Press shortcut key(s)”, press the keyboard shortcut you want to associate with the currently selected command
  4. Press Assign

If there’s a conflict, the “Shortcut currently used by:”  will show the conflict.  Pressing Assign will override the conflict.

Also note that there are different scopes.  There’s the combo box “Use new shortcut in:” which usually says “Global.”  This is the current scope for that particular keyboard shortcut.  For example, keyboard shortcuts assigned in the “Text Editor” scope will only work when focus is on the Text Editor.  If you place focus on a tool window and try the same keyboard shortcut, the command that is bound to that keyboard shortcut under global scope will execute.

Another “fun” way of learning about Visual Studio is to go through the list of commands available.  For example, if you type Edit.Line, you’ll see all of the commands that contain “Edit.Line”.  You’ll discover a command called “Edit.LineTranspose” which is bound to Shift+Alt+T.  In case you ever need to transpose a line, you now know the keyboard shortcut for it.

And vice versa, if you want to find out what the commands that are bound to Ctrl-<letter>, simply put the focus into the “Press shortcut key(s):” edit box and party on it ‘til your heart's content. 

Happy Editing!

Posted: Tuesday, April 05, 2005 5:33 PM by saraford

Comments

Jim said:

Is there a hotkey or action to switch from html view to design view in visual studio?
# April 6, 2005 10:42 AM

saraford said:

Yep, it is Ctrl-PgDn.

thanks,
-sara
# April 6, 2005 1:22 PM

JIm said:

Thx, thats great!
# April 6, 2005 3:37 PM

Murtaza said:

Would you happen to know how to bind the shortcut key "CTRL+SPACE+SHIFT" to type out "&nbsp;" in the HTML Text editor?

I cant find tis any where on the net.

-M
# May 5, 2005 10:48 AM
New Comments to this post are disabled
Page view tracker