All Articles

Favorite shortcuts in Visual Studio

Visual Studio is the IDE I use for making my ASP.NET Core and C# applications. I feel when I mainly use my keyboard instead of the mouse, my productivity increases and it feels I can keep the thought train going, which is essential in the creative process of programming. Hotkeys and shortcuts are therefore important to incorporate in your way of working. Although it is a time investment, it’s definately worth it.

keyboard-shortcut.jpg

Productivity increases when focussing on using solely the keyboard during development after some time invested.

Hereby a list of short cuts I use daily. I want to highlight two shortcuts that were important to me going ‘mouseless’:

  • ctrl + t to quickly access classes and files, where you can use each capital letter of CamelCase (cc) to quickly find what you are looking for.
  • ctrl + tab to quickly navigate between views and files.

View

alt + shift + enter distraction free mode
ctrl + q quick search
ctrl + ] move to closing (or beginning) brace
ctrl + m + m close / open block
ctrl + t open file in project
ctrl + tab go to other open file
ctrl + F4 close file
f11 move into constructor
ctrl + - move to previous view
ctrl + shift + - move to forward view
alt w + line close all open files
shift + F2 create new file or folder

Quick code

ctrl + . code suggestion
ctrl + r + r refactor
ctrl + d duplicate line
alt + ↑ move code line up
alt + ↓ move code line down
ctrl + shift + v show clipboard history
ctrl + k + x all code snippets (tab + tab to complete code snippet)
ctrl + k + s surrounding code snippets (also added custom surroundings)

Format

ctrl + k, c comment
ctrl + k, u uncomment
ctrl + k, d autoformat code
ctrl + r, g autoformat using statements

Run program

F5 start debug mode - go to next breakpoint
Shift + F5 stop debug mode
F9 set breakpoint
F10 step over method
F11 step into method
Shift + F11 step out of method
ctrl + F5 run
ctrl + r, t debug tests in context
ctrl + r, a run all tests

References