Friday, November 1, 2013

My Favorite Visual Studio Keyboard Shortcuts

I hate using my mouse.  I'm always looking for ways to cut out the travel time between my keyboard and mouse.  The repetition is hard on my arthritic wrist and it takes a significant amount of time.  Vim, in my eyes, is the holy grail of keyboard shortcut mastery.  There are games to help us on the outside get a grip on the Vim user interface.  Yes, there is a Vim plug-in for Visual Studio for the hardcore among us.  But...  I'm not there yet, so I thought I'd share the ones I use regularly, and where I go to learn new ones.
  1. Editor Related
    1. CTRL + S = Save
    2. CTRL + SHIFT + S = Save all
    3. CTRL + C = Copy
    4. CTRL + X = Cut
    5. CTRL + V = Paste
    6. CTRL + K + CTRL + D = Format code (puts nice spaces and indentations where you like them)
    7. ALT + SHIFT + T = Swaps the current line with the line below it
    8. CTRL + SHIFT + B = Build baby build!
    9. CTRL + D +  T = Debug unit test that is in context
    10. CTRL + R + T = Run unit test that is in context
    11. CTRL + K + CTRL + C = Comment out current line or selection of code
    12. CTRL + K + CTRL + U = Uncomment current line or selection of cote
    13. CTRL + . (that's a period) = Used to bring up context menu when you see the little underline or context menu icon show up after a code change. Mostly used during refactorings like changing a variable name or extracting a method from selected code.
    14. Context Menu Key (this is the key on my keyboard between right ALT and right CTRL) = Primarily used to access refactoring menus to create new functions or new variables.
    15. CTRL + F = Find
    16. CTRL + H = Replace
    17. CTRL + SHIFT + F = Find many (gives me a list of all instances)
    18. F3 = Move to next instance of matching text for a find text request
    19. SHIFT + F3 = Move to the previous instance of matching text for a find text request
    20. F9 = Toggle breakpoint
    21. F12 = Go to definition of the variable, method, or class
    22. CTRL + TAB = Switch between open files much like ALT + TAB and WINDOWS + TAB does in Windows.
    23. CTRL + F4 = Close currently focused code file
    24. CTRL + Spacebar = Give me intellisense and give it to me NOW!
  2. Debugger Related
    1. F5 = Run
    2. F9 = Toggle breakpoint
    3. F10 = Run current line of code only
    4. F11 = Step into function on current line of code
    5. SHIFT + F11 = Finish running current function and break in calling function

And one of my favorite quotes on shortcuts from the movie Road Trip:

It's supposed to be a challenge, that's why they call it a shortcut. If it was easy it would just be the way.

I'm sure I'm missing a few, so please add others that you use in the comments.

No comments:

Post a Comment