42 Visual Studio Shortcuts & Commands

I’ve been using Visual Studio as my primary code editor since 2008, and I put together a list of the top commands I use in VS 2015. I use most of these daily, but the less common ones are nice to fall back on in specific situations. I included the default keyboard bindings from the General profile where appropriate.

Navigation

1. Navigate Backward (Ctrl+-)
2. Navigate Forward (Ctrl+Shift+-)
These two commands are great for quickly moving the cursor back and forth between its most recent locations.

3. Toggle Bookmark (Ctrl+K,Ctrl+K)
4. Next Bookmark (Ctrl+K,Ctrl+N)
5. Previous Bookmark (Ctrl+K,Ctrl+P)
Bookmarks are useful for saving a location that you need to refer back to often. Alternatively, you can get a second monitor and drag the document out of the tab well to keep it visible.

6. Navigate To (Ctrl+,)
Navigate to classes, methods, files, etc. Uses partial string matching.

7. Quick Launch (Ctrl+Q)
Search for available commands, options, and tool windows.

IntelliSense

8. List Members (Ctrl+J)
9. Parameter Info (Ctrl+Shift+Space)
Show IntelliSense info without having to type a character, open paren, etc.

Editing

10. Duplicate Line (Ctrl+C,Ctrl+V)
11. Delete Line (Ctrl+X)
12. Move Line (Ctrl+X,Ctrl+V)
Cut/Copy apply to the current line if there is no active selection.

13. Paste/Cycle Clipboard Ring (Ctrl+Shift+V)
Did you get carried away with Ctrl+X and lose what you had on the clipboard? Use Ctrl+Shift+V to paste the previous clipboard contents.

14. Box Editing (Alt+Shift+Arrow)
Box editing lets you apply the same edit to multiple lines simultaneously, e.g. add readonly to a list of field declarations. Also works with the mouse instead of arrow keys.

15. Select Words (Ctrl+Shift+Arrow)
Hold down the Ctrl key while selecting text to auto-select whole words instead of using the default character boundary.

16. Comment Selection (Ctrl+K,Ctrl+C)
17. Uncomment Selection (Ctrl+K,Ctrl+U)
Like most other Visual Studio commands, these will apply to the current line if there is no active selection.

18. Format Document (Ctrl+K,Ctrl+D)
Why format the selection when you can format the whole document by using D instead of F?

19. Goto matching brace (Ctrl+])
Matches braces, parentheses, html tags, etc.

20. Find and Replace (Ctrl+F/Ctrl+H)
You can get a live preview for matches on regular expressions! Use with Shift for find in files.

21. Find Next (F3/Ctrl+F3)
22. Show Whitespace (Ctrl+R,Ctrl+W)
Shows spaces and tabs.

Language Commands (C#)

23. Goto Definition (F12)
24. Find All References (Shift+F12)
Use F8 and Shift+F8 to cycle through results.

25. Quick Actions (Ctrl+.)
Show available refactorings or generate code with consume-first development. This one gets more useful with every release.

26. Smart Break Line (Shift+Enter)
If the caret is at the ‘|’ in Console.Writeline(Foo(4|)), Shift+Enter will add the trailing semicolon and put the caret on the next line.

Build & Debugging

27. Build Solution (Ctrl+Shift+B)
28. Restore Nuget Packages (n/a)
Nuget has become more common recently. For larger solutions, it’s more efficient for me to manually restore when needed instead of performing the nuget checks on every build.

29. Start Debugging (F5)
30. Start Without Debugging (Ctrl+F5)
31. Stop Debugging (Shift+F5)
32. Exception Settings (Ctrl+Alt+E)
33. Attach To Process (Ctrl+Alt+P)
Useful after Ctrl+F5 or when you need to attach to something that’s already running. If you detach from a process that started without debugging, it will keep executing.

34. Step Over (F10)
35. Step Into (F11)
36. Step Out (Shift+F11)
37. Run To Cursor (Ctrl+F10)
38. Step Into Specific (Shift+F10, F)
39. Toggle Breakpoint (F9)
40. Enable/Disable Breakpoint (Ctrl+F9)
The debugger is one of Visual Studio’s best features. With VS 2015 improvements to EnC, you can fix more types of errors without having to stop to rebuild your code.

Testing

41. Run Tests (Ctrl+R,T)
42. Debug Tests (Ctrl+R,Ctrl+T)
These are context sensitive. Place the caret in a method body to run a single test or in a class to run the tests from that class.

Conclusion

These commands cover most of my daily usage of Visual Studio. Note that you can browse or customize all Visual Studio commands and keybindings from the Options dialog (Alt+T, O, K). If you find yourself repeatedly performing a certain command, assign it to a keyboard shortcut. Unused keybindings are rare, so feel free to repurpose an existing one.

Did I leave out any of your favorite Visual Studio commands? Let me know in the comments.

 
Conversation
  • Justin says:

    That’s a terrific list.
    Thanks for putting it together.

    ClipboardRing! SmartBreakLine! Good ones. ;-)

  • Comments are closed.