Restrict Blank Line Cut or Copy while coding in Visual Studio

Restrict Blank Line Cut or Copy while coding in Visual Studio

Here is another handy and quick tip that can you help you to avoid accidental copying blank line of code.  During the development sometime we hit Ctrl+C  (copy) where as we actually wanted to do a Ctrl+V(past) . With this you missed what had been copied, also it copied a blank line. In case of Clipboard Ring feature, you have a blank line copied with in your clipboard cycle and it is difficult to get rid of it unless you do a complete cycle of new selection.

 

Did you know – In Visual Studio you can copy multiple code blocks together and paste them one by one ?

 Navigate to Tools -> Options -> Text Editor -> All Languages / C# , under settings unchecked the “Apply Cut or Copy commands to blank lines when there is no selection” checkbox. By default it is checked.

image

With this option selected , Visual Studio will ignore any copy item to clip board when there is no selection.

   This is very handy when it comes multiple copy paste.

Hope this helps !!

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.

One Comment to “Restrict Blank Line Cut or Copy while coding in Visual Studio”

Comments are closed.