Shortcut for duplicating lines in Visual Studio

I have searched and searched for a shortcut for duplicating lines in Visual Studio 2013. Each time I find smart ass answers like this. Which leads to a rant about StackOverflow, but that is another post. To me Visual Studio is too powerful an IDE to not have something built in. I was playing around with some things one day, just because I had a tone of code to write and anything I could do to make it faster would make me a happy coder. I finally stumbled upon a shortcut for duplicating lines in Visual Studio. At this moment I am only able to test this with VS 2013, but I would be surprised if it didn’t work in older versions as well.

Here are the steps:

  1. Highlight the code you want to copy and hit CTRL -> C
  2. Make sure you have the space you want to past this into, i.e. you will want to hit enter a few times to make space.
  3. Then while holding down ALT and SHIFT arrow down the number of times you want to copy. You should see a slim line appear
  4. After you have the lines highlighted you can finish by doing a CTRL -> V
  5. Your line should appear in the space you selected.

This was the closest thing I found to a shortcut for duplicating lines in Visual Studio. Other programs have a set of quick keys that you can hit and copy a line over and over again. Obviously this method is not ideal, but it is better than typing the same line over and over again or doing CTRL -> V over and over again. Some will probably feel like this is more work than just CTRL -> V also and I respect your opinion. You need to do what you feel works best for you, not what anyone else tells you. Maybe someday Visual Studio will catch up with the rest of the text editors and add this feature in as a simple key command. If you know of another one I would love to hear it. This was just one of the first I stumbled upon and I am sure there are others.


Leave a Reply

Your email address will not be published. Required fields are marked *

Enter Captcha Here : *

Reload Image