Visual Studio Tips and tricks: Multi-line and multi-cursor editing

  • Gérald Barré

This post is part of the series 'Visual Studio Tips and Tricks'. Be sure to check out the rest of the blog posts of the series!

Visual Studio allows to edit multiple lines at the same time. This is very useful to apply the same change to multiple lines. For instance when you want to add the modifier to multiple properties.

#Multi-line editing using mouse

Press Alt while selecting the block with the mouse:

#Multi-line editing using keyboard

Press Alt+Shift+Arrow to select the block to edit:

#Multi-carets editing

If you want to edit multiple places that are unaligned, you can use the multi-cursor edit. Press Ctrl+Alt and click where you want to add a caret. The

#Insert carets at all matching locations

You can insert a caret at all places where the current word exists. Select the word you want to match and press Alt+Shift+;. Visual Studio will select all the locations that match the selected text in the current document.

You can select just the next matching location by using Alt+Shift+.

Do you have a question or a suggestion about this post? Contact me!

Follow me:
Enjoy this blog?Buy Me A Coffee