View White Space


Keyboard:  CTRL + R, CTRL + W
Menu:  Edit -> Advanced -> View White Space
Command:  Edit.ViewWhiteSpace
Versions:  2008,2010
Published:  4/9/2010
Code:  vstipEdit0043

I’ve hijacked today’s tip to remind everyone that next Monday I will start giving away $100 ThinkGeek gift certificates (one every day for about 30 days).  For details of my evil plan, go here.  Also, make sure to sign up for a Visual Studio Launch event in your area.  Happy coding!


Download the seriously cool Tip of the Day Extension to get the daily tips delivered to your Start Page!

 


Ever want to see the white space you are working with?  Maybe you want to know if your spaces are tabs or you have extra spaces on lines.  It’s easy to view white space.  Just go to Edit -> Advanced -> View White Space (CTRL + R, CTRL + W) to go from this:


image


 


To this:


image

Comments (11)

  1. Leo Davidson says:

    I’ve always used Ctrl-Shift-8 but Ctrl-R, Ctrl-W is easier to type if I can re-train my brain after all these years. 🙂

  2. Mark Donoghue says:

    I Think this is a very Geek-y tip – and I love it – doesnt hurt that its my birthday.  Oh wait that doesnt start until Monday?  Oh well never mind – I still love this tip – I have a lot of code using spaces that should be using tabs – now I can see where the places to change are 🙂

  3. zainnab says:

    muhahaha already working me for the gift certificates I see 😛

  4. Daniel Rose says:

    Alternative is Ctrl-E, Ctrl-S.

  5. zainnab says:

    Daniel,

    Good one!  That is a C# key mapping but you have inspired me to include additional mappings in the book.  I have had enough people ask about additional mappings that it’s probably time to document them.

    Z

  6. Catto says:

    Hey Now Zain,

    Another Great one! Was looking for the hotkey –  CTRL + R, CTRL + W & o'f course you got it.

    Thx 4 the info,

    Catto

  7. Forward compatibility says:

    You know that in the next revision of visual studio, this is all not going to work..

  8. zainnab says:

    Forward,

    Actually it WILL work in the next version of Visual Studio and works even in the beta that you can download today.  🙂

    Z

  9. Martin Andersson says:

    Yeah I wouldn't mind if you added a line as to how one can change what white space characters are displayed. In my visual studio, I don't see the tabs or anything else, only spaces. Anyways, thanks for half the pie.

  10. zainnab says:

    Hey Martin 🙂

    Spaces and tabs are usually what you get with a feature like this.  What other whitespace would you like to see?

    Z

  11. AndersFanboy687 says:

    @Martin Anderson: Visual Studio automatically turns your tabs into spaces for you. As usual, this is a configurable setting. Some people prefer this because some operating systems interpret tabs as being equal to different numbers of spaces. (If I recall, it's 4 spaces to a tab in Windows, and 3 to a tab in *nix OSs)