Introduction

In this blog, you will learn 10 Visual Studio Ninja Code Editor Productivity Tips.

1. Move one or several lines up and down

The line that contains the editing caret can be moved up and down with Alt+Up and Alt+Down.
In the same way, several selected lines can be moved up and down.
Move lines up and down with Alt+Up and Alt+Down
Move lines up and down with Alt+Up and Alt+Down

2. Rectangular Selection

Rectangular selection is very useful to quickly edit a code portion. This can be achieved with Alt+Shift+Arrows shortcuts.
Rectangular Selection with Alt+Shift+Up/Down/Left/Right.
Move lines up and down with Alt+Up and Alt+Down

3. Multi-Lines Edition

Once mastering rectangular selection, it can be used to edit multiple lines at once,
Multiple Lines Edition
Multiple Lines Edition

4. Multi-Carets Edition

Often we need to repeat the same edition at multiple locations. To do so multiple carets can be defined with Ctrl+Alt+Mouse Click,
Multiple Carets with Ctrl+Alt+Mouse Click:
Multiple Carets with Ctrl+Alt+Mouse Click

5. Multi-Carets Edition on Same Matches

Multiple carets can be set to the next locations of the selected word. To do so first select the word and then use Ctrl+Shift+;
Multiple carets can be set to all locations of the selected word with Ctrl+Shift+$.
Same Match Selection
Same Match Selection

6. Expand / Contract Selection

You can expand the selection with Shift+Alt+= and contract it with Shift+Alt+.
Expand Selection
Expand Selection

7. Make Selection Uppercase/Lowercase

You can Uppercase the selection with Ctrl+Shift+U and lowercase it with Ctrl+U
Make Selection Uppercase / lowercase
Make Selection Uppercase / lowercase

8. Outlining

The most important keyboard shortcut when it comes to outlining is Ctrl+M Ctrl+M. This shortcut expands/collapses the code portion that contains the caret.
Not all developers enjoy outlining and if you are one of those, you can discard it with Ctrl+M Ctrl+P.
Expand / Collapse Outlining
Expand / Collapse Outlining

9. Vertical Scrollbar Map Mode

The map mode is one of the most useful Visual Studio code editor facility. It does really help to find your way in the source file.
Vertical Scrollbar Map Mode
Vertical Scrollbar Map Mode
It can be set from Visual Studio > Tools > Options > Text Editor > All Languages > Scroll Bars > Behavior.
The width of the map can be: Narrow Medium Wide
Set Vertical Scrollbar Map Mode
Set Vertical Scrollbar Map Mode

10. Bookmarks

When developing we often have to come back and forth through multiple locations in several source files. Fortunately, you can concretely define this locations-set with bookmarks. Here are bookmarks shortcuts,
  • Ctrl+K, Ctrl+K to toggle a bookmark at caret position
  • Ctrl+K Ctrl+N go to Next bookmark
  • Ctrl+K Ctrl+P go to the Previous bookmark
  • Ctrl+K Ctrl+L clear all bookmarks
Note that Visual Studio remembers bookmarks when closing it and restarting it.
Toggle Bookmarks with Ctrl+K, Ctrl+K
Set Vertical Scrollbar Map Mode

Bonus: Visual Studio 2019 Clipboard Ring Preview

Ctrl+C copy some data to the clipboard. Actually Visual Studio maintains a clipboard ring to store several data.
With Visual Studio 2019 Ctrl+Shift+V shows a preview of the various data in the clipboard ring. This is quite useful to navigate through the copy history.
Visual Studio 2019 Clipboard Ring Preview
Visual Studio 2019 Clipboard Ring Preview

Conclusion: Visual Studio > Edit > Advanced

The Visual Studio menu Edit > Advanced is both a good start and a good reminder for code editor keyboard shortcuts.
Visual Studio Edit Advanced
There are more sub-menu including Bookmarks, Outlining, Intellisense, and Multiple Carets.