Click here to Skip to main content
14,545,626 members

Visual Studio Tips - Bulk Editing Shortcuts

Rate this:
5.00 (4 votes)
Please Sign up or sign in to vote.
5.00 (4 votes)
16 Apr 2019CPOL
Bulk editing shortcuts in Visual Studio

One of the most tedious things we do as developers is making repetitive changes. Maybe we need to set a handful of properties on a single object, or perhaps we want to add a property to the instantiation of a bunch of test objects. Here are a few shortcuts to help you with that.

Multi-Caret Editing

Let’s start with adding a property to the instantiation of some test objects. This is often the perfect scenario for “muti-caret editing.” To start this, you can do two things. The first is to position your caret where you’d like to start editing on the first line, then hold Shift+Alt and either use your arrows or the mouse to select a column or area. The beautiful thing about this method is it allows you to select a block of text to replace.

Image 1

The drawback of using Shift+Alt is that the columns you want to edit must line up vertically. But frequently, that isn’t the case, and that’s where Ctrl+Alt comes into play. With Ctrl+Alt, you set the multiple carets by holding Ctrl+Alt and clicking where you want to edit. You can then insert text in all those places, even multiple times on the same line.

Image 2

Duplicate Line

Those work great if the lines you want to edit already exist, or if you know how many lines you need to create at once. But I often find myself wanting to duplicate a line and make a few changes to it. For that, you can use the Ctrl+E, Ctrl+V keyboard shortcut which duplicates the line your cursor is on.

Image 3

Clipboard Ring

Another feature I find very useful when I’m making repeated edits is the Clipboard Ring. When you hit Ctrl+Shift+V, it brings up your clipboard ring which includes the last nine things you’ve copied or cut (more recently used at the top). You can then select the item you want to paste by typing the number, using your arrow keys or clicking with your mouse.

Image 4

This can be useful when you need to copy multiple things from one file to another. You no longer need to flip back and forth, just copy, copy, paste, paste.

Insert File as Text

This last feature I just stumbled upon while looking for something in the Edit menu. It’s not something I expect to use a lot, but it might be useful. In the edit menu is a command “Insert File as Text”, and the command does just what it says.

Image 5


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Jeremy Hutchinson
Software Developer
United States United States
I’m a Software Engineer at Microsoft working on the Azure Portal. Before that I spent about 20 years developed various business applications at a number of different companies. I have a passion for writing clean, scalable code and sharing what I’ve learned with others.

I also help run the Casco Bay .Net User Group

Comments and Discussions

QuestionDuplicate Line Pin
Michel Renaud17-Apr-19 2:48
MemberMichel Renaud17-Apr-19 2:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Posted 16 Apr 2019

Tagged as


3 bookmarked