Best Code Editor Keyboard Shortcuts In Visual Studio For More Productivity

Every developer wants to improve their productivity while coding, so it's very critical to know a few basic Visual Studio code editor keyboard shortcut keys, that will improve your coding style and productivity. It will help you to stop donkey work while coding and work more professionally, such as moving code inside the text editor.
 

Move Code 

 
So let's see how to do this.
  1. Select your code inside Visual Studio Text Editor that you want to move. 
  2. Then hold down the alt key and press up arrow and down arrow to move your code around the Text Editor.
Preview
 
alt + up/down arrow 

Best Code Editor Keyboard Shortcuts In Visual Studio For More Productivity
 

Duplicate Code 

 
Let's see how to do this.
  1. Select your code inside Visual Studio Text Editor that you want to duplicate.
  2. Then hold down the ctr key and press the d button to duplicate your code inside the Text Editor.
Preview
 
ctrl + d button
 
Best Code Editor Keyboard Shortcuts In Visual Studio For More Productivity
 

Wrap code with different statements

 
Let's see how to wrap your code statements with foreach statement.
  1. Select the code that you want to wrap by using the mouse or pressing Shift+ Right/Left arrows.
  2. Then hold down the ctr key and press k+s button. A popup window will show all the basic statements available.
  3. Search and select your desired one, I'm going to select the foreach statement and press the enter button.
Preview
 
ctrl + k + s button
 
Best Code Editor Keyboard Shortcuts In Visual Studio For More Productivity
 

Comment/Uncomment code

 
Let's see how to comment and uncomment code using keyboard shortcut key inside Visual Studio code editor.
  1. Select the desired code that you want to comment.
  2. Then hold down the ctr key and press k+c for comment the code.
  3. To uncomment the code, hold down the ctr key and press k+u.
Preview
 
ctrl + k + c button for comment / ctrl + k + u button for uncomment
 
Best Code Editor Keyboard Shortcuts In Visual Studio For More Productivity
 

Code formating 

 
Let's see how to format selected code or complete code document in VisualStudio code editor with keyboard shortcut keys.
  • Format Document - Hold down the ctr key and pres k + d to format the complete document.
  • Format Selection - Hold down the ctr key and press k + f to format selected code inside the document.
Preview
 
ctrl + k + s button
 
Best Code Editor Keyboard Shortcuts In Visual Studio For More Productivity
 

Summary 

 
In this article, we learned how to move code, duplicate code, wrap code with statements, comment/uncomment code and do code formating using Visual Studio code editor keyboard shortcut keys. You will find these shortcuts very helpful in your daily life coding.