My Favourite Shortcuts - Visual Studio 2017

in #programming7 years ago


I've been using Visual Studio since I started programming. At first I used a lot my mouse to scroll, select, copy, paste text. Or to open or switch between windows. When I started getting better I realized that the time moving my hand to the mouse, doing the task, and moving my hand back to the keyboard is slowing me down. So I started learning some of the useful shortcuts of Visual Studio and I'm coding much faster now.

Selecting / manipulating text

  • So you obviously know CTRL + C and CTRL + V and CTLR + X too! But did you know that if you want to copy a line you don't have to select it, just move your cursor to the line (with the arrow keys) and press CTRL + C.
  • Or did you know Visual Studio holds some of your recent clipboard values. Press CTRL + V multiple itimes to get your clipboards before your current one!
  • If you missed the clipboard value you can press CTRL + SHIFT + V to go backwards!
  • CTRL + SHIFT + L removes a line without copying it to the clipboard.
  • CTRL + UP/DOWN ARROW Scrolls the text without moving your cursor.
  • CTRL + W selects a word.
  • CTRL + LEFT/RIGHT ARROW moves the cursor from word to word. Combine that with SHIFT and you can select text much faster.
  • After you've selected a text you can use ALT + UP/DOWN ARROW to move the text up or down a line!

Navigation

  • You can move your cursor to a variable/method/class and press F12 to go to the definition of it.
  • You can move your cursor to a variable/method/class and press SHIFT + F12 to Display all references to it.
  • Obviously you can press CTRL + F to bring up the find window and find a text in your source file
  • You can press CTRL + H to bring up the replace window and press ALT +A to replace all occurances
  • You can press CTRL + T and type in the name of a variable, class, method, select if from the list and press enter to go to it's definition
  • You can press CTLR + K + K it means you hold down CTRL and press K twice to insert a bookmark at the current line

Formatting

  • Select something and press CTRL + K + F to format that text, insert/remove whitespaces
  • Press CTRL + M + M to collapse/open a code block. You can collapse anything that has { and }
  • Press CTRL + R + G to remove unused using statements and sort them alphabetically
  • Press ALT + ENTER on something to bring up the Suggestions menu, navigate with the arrow keys and press eneter to apply a suggestion

Windows

  • Press CTRL + ALT + O to bring up the output window
  • Press CTRL + \ + E to bring up the errors window
  • Press CTRL + K + W to bring up the bookmark window, you can select a bookmark with the arrow keys and press F2 to rename that bookmark
  • Press F7 in designer view to view the source code of the form, you can press SHIFT + F7 in the source code view to open the designer view of the form
  • Hold down CTRL + TAB to navigate between open windows and press TAB to move forward or SHIFT + TAB to move backwards, additionally you can keep the CTRL held down and use the arrow keys to navigate between windows. When the window you want is selected just release the CTRL key, and you will go to that window.
  • Press CTRL + ALT + L to open the solution explorer.

Debugging

  • Press F5 to start/continue the application, CTRL + F5 to stop the application or CTRL + SHIFT + F5 to stop the application
  • Press F9 to insert a breakpoint
  • Press CTRL + ALT + BREAK to pause an application
  • When in break mode:
    • Press F10 to execute a statement and step over it
    • Press F11 to execute a statement and step inside of it
    • Press SHIFT + F11 to execute a statement and step out of it

Summary

So that was my list of the shortcuts I find really useful. There are far more shortcuts than in this list, so if I missed something you can always lookup the shortcuts your looking for in VS itself under Tools > Options > Envinroment > Keyboard. Comment down below your favourite shortcuts!
I hope this helps you to speed up your coding too!

Coin Marketplace

STEEM 0.22
TRX 0.24
JST 0.038
BTC 95076.63
ETH 3277.51
USDT 1.00
SBD 3.26