I recently did a presentation of VS tips at the Philly.Net user group. My presentation included some tips for Visual Studio 2013 as well as some for older versions. I’ve bundled 3 related tips into one post here.
The first tip is one that applies to past versions of Visual Studio but it always surprises me how few people know about this. When you are pasting content in Visual Studio, instead of using the traditional Ctrl + V to paste, use Ctrl + Shift + V to cycle through the clipboard ring. It is simple and easy to use. Sometimes I use Ctrl C to copy some text and when I try to paste it I hit Ctrl C again by mistake. Now I just copied a (usually) blank line into my clipboard and I can’t get back to the text I really wanted to paste. Fear not, Ctrl + Shift + V to the rescue and I can cycle back through the clipboard to the text I really wanted.
Avoid Copying Blank Lines
In the tip above, I mentioned a common scenario where I sometimes use Ctrl + C by mistake when I really want Ctrl V for “paste”. Sure the clipboard ring can help solve that problem but VS 2013 introduces a new feature. Just click on over to the options page at Tools > Options and then navigate to Text Editor > All Languages (or better yet, use Quick Launch and type in “blank lines”). You’ll see this:
In your case, the checkbox is probably checked. Uncheck it and you won’t have to worry about this again!
Box Selection/Column Mode
Once again, this feature has been in VS for a long time but many, many devs still don’t know about it. Everyone (right?) knows about using Ctrl + right/left arrows (or the mouse) to select text. But in the following sample, I realize that I have four variables declared as string but they should be int.
To fix them, I can just use Ctrl + Alt + the arrows or the mouse. But now, it is not just the left and right arrows but the up and down arrows as well.
And while that is selected, I can just start typing:
Play around with this. You can also use it to insert totally new text on all lines too.