You are here
Home > Visual Studio 2013 > Visual Studio 2013 Avoid Copying Blank Lines

Visual Studio 2013 Avoid Copying Blank Lines

Visual Studio 2013 Avoid Copying Blank Lines – Yes, it is something that happens to me often. I don’t know why I do it so easily. I guess it is because I use the keyboard shortcuts to copy and paste (Ctrl+C and Ctrl+V).

When I want to cut, I type Ctrl+X and then because my finger is moved one key to the left, I type Ctrl+C instead of Ctrl+V. It has been the bane of my Visual Studio experience since Visual Studio 2003 and has infuriated me endlessly (even if that fury is only vented at my own stupidity). But this little pet peeve of mine is particularly troublesome when I am already frustrated with difficult code.

With Visual Studio 2013 we see an option available to avoid this silly mistake (and save some of my sanity).

Visual Studio 2013 Avoid Copying Blank Lines

To enable this feature, head on over to Tools-> Options.

Visual Studio 2013 Avoid Copying Blank Lines

In the search text box type in ‘cut copy’ and the results will filter as you type. This is another awesome enhancement of the Options dialog that I love. No more clicking through endless menu’s to find some setting you used a few weeks ago.

Here you will see that there is an option under ‘All Languages | General’ called ‘Apply Cut or Copy commands to blank lines when there is no selection’. By default it should be checked, which brings me to the question of why anyone would want to copy a blank like to begin with. Deselect that option and your problem is resolved.

Lastly, as pointed out by Zain Naboulsi, deselecting this option will prevent you from using Shift+DEL to delete an empty line. If you simply can’t live without Shift+DEL, you will have to enable this feature.


This functionality is also available in Visual Studio 2012 under the same options menu. Thanks to jphamilton in the comments for the tip.

Dirk Strauss
Dirk is a Software Developer from South Africa. He loves all things Technology and is slightly addicted to Jimi Hendrix. Apart from writing code, he also enjoys authoring books and articles. "I love sharing knowledge and connecting with people from around the world. It's the diversity that makes life so beautiful." Dirk feels very strongly that pizza is simply not complete without Tabasco, that you can never have too much garlic, and that cooking the perfect steak is an art he has almost mastered.

Similar Articles