Visual Studio (2005,2008,2010) Tips and Tricks.
#22 Delete the beginning white space for selected line(s)
Wednesday, January 28 2009
Weather you are trying to copy/paste some code into an IM for a friend to look at, or want to better align your source code, you will want to start by removing he white space at the beginning of the line. This quick trick shows you how.
Snippets / Notes:
[CTRL]+K, [CTRL]+\ = Remove all white space at the beginning of the line
Visual Studio Tip / Trick #022 English Transcription:
Today’s Visual Studio video trick of the day Trick number 22 was originally posted in text by Sara Ford in August of 2007. The Trick of the day is removing white space at the beginning of the line. So you’ll notice this white space here. If you use the keyboard combination, short-cut of [CTRL]+[K], [CTRL]+[Backslash], all of the white spaces at the beginning of all lines you have selected will be removed.
Now that would still be true if the lines you have selected have different indentation. So you’ll see the last four lines there [CTRL]+[K], [CTRL]+[Backslash] will all get moved to the beginning of the line. So all the white spaces deleted. Now there are some other people online that talk about the [SHIFT]+[TAB] trick and if you [SHIFT]+[TAB], that will maintain your current Tabing structure and then if you do [SHIFT]+[TAB] again you will continue to move those lines to the left until there is no more white space. So today’s trick of the day [CTRL]+[K], [CTRL]+[Backslash] to remove the beginning of the line white space.
1 comment(s)
I use [CTRL] + Backspace to remove whitespace from a single line, and [SHIFT] + Tab to outdent multiple lines. When I want to paste code to IM, I use [ALT] + Mouse Drag as you showed in scottcate.com/.../002 to select a block of source code without having to outdent the lines.