Visual Studio Tips and tricks: Multi-line and multi-cursor editing
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 the mouse
Press Alt while selecting the block with the mouse:
#Multi-line editing using the 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+.
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!
- View and edit the Tab Order of Windows Forms Controls
- Comparing files using Visual Studio
- Visual Studio Tips and tricks: Clipboard history
- Visual Studio Tips and tricks: Open recently closed files
- Visual Studio Tips and tricks: Multi-line and multi-cursor editing (this post)
- Visual Studio Tips and tricks: Extend/Reduce selection
- Visual Studio Tips and tricks: Undock/Re-dock a tool window
- Visual Studio Tips and tricks: Regex editing
- Visual Studio Tips and tricks: Find the current opened file in the solution explorer
- Visual Studio Tips and tricks: Default startup project
- Visual Studio Tips and tricks: Open the documentation of a symbol
- Visual Studio Tips and tricks: Paste as JSON
- Visual Studio Tips and tricks: Add project reference using drag & drop
- Visualizing the code coverage results from Azure Pipelines in Visual Studio
- Debugging a .NET assembly without the source code with Visual Studio
- Visual Studio Tips and tricks: Subword navigation
Do you have a question or a suggestion about this post? Contact me!