Stack Overflow has covered favorite short-cuts and add-ins, optimizations and preferences -- great topics all. If this one has been covered, I can't find it -- so thanks in advance for the link.
What are your favorite Visual Studio keyboard remappings?
Mine are motivated by the fact that I'm a touch-typist. Mouse, function keys, arrow keys, Home, End -- bleh. These are commands I do all day every day, so I've remapped them to sequences I can execute without moving my hands from the home row.
The command that is remapped in Tools => Customize => [Keyboard] is shown in parentheses.
I'm 100% positive that there are better remappings than these, so please post yours! Please include the command; oft times, figuring it out is a challenge.
-- Hoytster
Running the app and operating the debugger
Ctrl+Q + Ctrl+R Run the application, in debug mode (Debug.Start)
Ctrl+Q + Ctrl+Q Quit (stop) the application (Debug.StopDebugging)
Ctrl+T Toggle a breakpoint at the current line (Debug.ToggleBreakpoint)
Ctrl+K + Ctrl+I Step Into the method (Debug.StepInto)
Ctrl+K + Ctrl+O Step Out of the method (Debug.StepOut)
Ctrl+N Step over the method to the Next statement (Debug.StepOver)
Ctrl+K + Ctrl+H Run the code, stopping Here at the cursor position (Debug.RunToCursor)
Ctrl+K + Ctrl+E Set then next statement to Execute (Debug.SetNextStatement)
Navigating the code
Ctrl+S Move a character LEFT (Edit.CharLeft)
Ctrl+D Move a character RIGHT (Edit.CharRight)
Ctrl+Q + Ctrl+S Move to the LEFT END of the current line (Edit.LineStart)
Ctrl+Q + Ctrl+D Move to the RIGHT END of the current line (Edit.LineEnd)
Ctrl+E Move a line UP (Edit.LineUp)
Ctrl+X Move a line DOWN (Edit.LineDown)
Ctrl+K + Ctrl+K Toggle (add or remove) bookmark (Edit.ToggleBookmark)
Ctrl+K + Ctrl+N Move to the NEXT bookmark (Edit.NextBookmark)
Ctrl+K + Ctrl+P Move to the PREVIOUS bookmark (Edit.PreviousBookmark)
Ctrl+Q + Ctrl+W Save all modified Windows (File.SaveAll)
Ctrl+L Find the NEXT instance of the search string (Edit.FindNext)
Ctrl+K + Ctrl+L Find the PREVIOUS instance of the search string (Edit.FindPrevious)
Ctrl+Q + Ctrl+L Drop down the list of open files (Window.ShowEzMDIFileList)
The last sequence is like clicking the downward-facing triangle in the upper-right corner of the code editor window. VS will display a list of all the open windows. You can select from the list by typing the file name; the matching file will be selected as you type. Pause for a second and resume typing, and the matching process starts over, so you can select a different file. Nice, VS Team. The key takes you to the tab for the selected file.
OK, it's a community wiki; edit away. :)
For editing and rearranging I've found the following 3 very useful, even though they're not on the home row:
Keypad + for Edit.Copy
Keypad - for Edit.Cut
Keypad * for Edit.Paste
These are easy to hit (even with the right thumb, at a pinch, if your right hand is holding the mouse) and require no meta keys. I often work by writing snippets then turning it into compilable code using search and replace, and then copying in words from elsewhere. The second step is usually most efficiently done by using the cursor with the mouse, so I've not found it a problem that these keys are so far away from the typing set -- being able to hit them without meta keys is more important.
(For commenting out large swathes of code, the above makes it impossible to use the numeric keypad to quickly add in /*
or */
. I've taken to using Edit.CommentSelection
and Edit.UncommentSelection
instead, or Visual Assist's comment selection facility. These have the additional slight advantage of not producing unnestable comments.)
Only other particularly useful shortcuts I find myself stuck without are these two:
View.FindResults1
View.FindResults2
The other lesser windows have keyboard shortcuts for them by default; I'm not sure why the Find Results windows don't.