Visual Studio Tips and Tricks

Productivity Driven Development

Disable Copy of Empty Text

| Comments

I have had this happen to me so many times:

  • I select a block of text to copy;
  • I move the cursor the place where I want to paste the code;
  • I accidentally press Ctrl+C again instead of Ctrl+V;
  • My block of copied text is replaced by an empty block;
  • I have to go back and do it all over again. Grrrrr.

Luckily I found out that this behavior can be disabled in Visual Studio. To do so, go to Tools > Options > Text Editor > All Languages > General > ‘Apply Cut or Copy Commands to blank lines when there is no selection’ and uncheck the checkbox. Sometimes you might also have to do this in a specific language option, like under Tools > Options > Text Editor > C# > General.

Want to learn more about Visual Studio? Check out this Pluralsight Course.
Use SqlSmash to write maintainable SQL scripts, understand code faster and navigate around easily in SSMS.