Brendan Enrick

Daily Software Development

Daily Dev Speedup - Selecting and Dragging Lines

Yesterday I posted about how important it is to use keyboard shortcuts and tools to help you write code faster. Any developer working towards self-improvement should be looking not only into how to program better but also how to program faster.

Today I'll start by mentioning a pretty easy one. If you use Visual Studio I really hope you keep line numbers on. I could probably claim that as the first tip since it does speed things up. This is especially true when collaborating with someone when they can say the line number about which they are speaking. For the real tip I'll be mentioning here you do not need to have the line numbers enabled, but they give you more surface area to click on.

This actually works in a lot of programs, but I'll explain how to use it in Visual Studio. All you need to do is click on the left hand edge of a line and you will be able to select the whole line (this includes the new line at the end). If you click and drag you can select multiple whole lines easily.

Along with this trick you are also able to easily select any text that is highlighted and you can click and drag it to a new location. These work well in combination because rearranging lines becomes very easy. Moving any code at all in fact becomes very easy.

Below is a demonstration of what can be done by clicking and dragging text around and highlighting using the line numbers.

Loading