Click here to Skip to main content
14,173,097 members
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

1.5K views
2 bookmarked
Posted 16 Apr 2019
Licenced CPOL

Visual Studio Tips - Bulk Editing Shortcuts

, 16 Apr 2019
Rate this:
Please Sign up or sign in to vote.
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.

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.

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.

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.

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.

License

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

Share

About the Author

Jeremy Hutchinson
Software Developer
United States United States
I’m a Senior Engineer at Quicken Loans and a Microsoft Azure MVP. I’ve has been developing line of business applications for 15 years primarily in the Microsoft Stack, and 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

You may also be interested in...

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.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web01 | 2.8.190524.3 | Last Updated 16 Apr 2019
Article Copyright 2019 by Jeremy Hutchinson
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid