The majority of commands you can perform via Visual Studio’s toolbars and menus can also be performed utilizing keyboard shortcuts. For those of you wanting a complete list, check out this MSDN page which lists the default keyboard mappings broken down into categories. There are too many to cover in detail, but I’ll list some of the ones I use regularly:
- Goto Line: Ctrl+G
Brings up Go To Line allowing you to automatically jump to a line position
- Toggle Bookmark: Ctrl+K, Ctrl+K
Set a bookmark to allow you to easily jump back to that position later.
- Next Bookmark/Previous Bookmark: Ctrl+K, Ctrl+N (Next); Ctrl+K, Ctrl+P (Previous)
Moves between your set bookmarks.
- Insert/Remove (Simple) Breakpoint: F9
Create a default breakpoint which always fires when debugging.
- Insert (Complex) Breakpoint: Ctrl+B
Brings up breakpoint dialogue allowing for conditional breakpoints, etc.
- Start (with Debugging if in Debug build): F5
- Run without Debugging: Ctrl+F5
If you are in a release build, both F5 and Ctrl+F5 behave the same.
- Iterate Through Build Errors: F8
If your build fails, you can press F8 to move between the various errors in the task list.
- Comment and Uncomment Code: Ctrl+K,Ctrl+C (Comment), Ctrl+K, Ctrl+U(Uncomment)
Works on current line or multiple selected lines.
- Intellisense Autocomplete: Alt+RArrow or Ctrl+Space
Start typing a keyword, then press Alt + Right Arrow or Ctrl + Space and Intellisense will complete the word (if what you’ve typed is identifiable) or bring up Intellisense with the nearest match. You can also do this before typing and Intellisense will come up.
- Dynamic Help: F1
Get in center of a method, type, class, etc in editor, press F1. Help comes up on that topic if it exists.
- View Code-Behind: F7
View the code-behind file from the .ASPX or .ASCX file
- Switch between Design and HTML View: Ctrl + PgUp or Ctrl + PgDown
Move between HTML and Design view on .ASPX and .ASCX files.
- Switch between Tabs: Ctrl+Tab (Back), Ctrl+Shift+Tab(Forward)
Useful for moving between open files in Visual Studio. Keeps track of the order in which you last visited the tabs and cycles through that.
- Go To Definition: F12
Click, Select or have cursor on text you wish to go to the definition of.
- Last cursor position: Ctrl + –(Back), Ctrl+Shift+- (Forward)
Useful for moving between files you have been editing. Especially useful if you have done a Go To Definition or if you are stepping though code in the debugger.
- Toggle Wordwrap:Ctrl + R, Ctrl + R
While you should make it a practice to limit the width of your lines so they don’t require wrapping, sometime you do have lines that scroll off the Screen. This wraps them for you so you can see the entire text without scrolling.