Visual Studio Tip #7: Whole line editing
OK here is a quick simple one. How do I move or edit entire lines of code?
#1 Just don’t select anything.
If you don’t have anything selected in your code window then the commands for copy, cut and paste work as if the entire line of code was selected.
So if you need to quickly duplicate a line, don’t bother trying to get a whole line selected. Just put the cursor on the line then type Ctrl+C, Ctrl+V and you’ll see the new line pasted below the old line.
#2 Just move the line. Put your cursor on the line in question and use Alt+UpArrow or Alt+DownArrow to move the entire line up or down in your file.
This post is part of a series of Visual Studio tips. The first post in the series contains the whole list.
(next tip: Adding existing files with Show All Files)
Comments
Anonymous
May 15, 2015
The comment has been removedAnonymous
May 15, 2015
@Justin Are you sure that's not a Resharper hotkey?Anonymous
May 15, 2015
Ctrl-D is ReSharper-onlyAnonymous
May 16, 2015
The comment has been removedAnonymous
May 20, 2015
Alt+Up or Down, just like in Office!