Skip to content

Tip 2.9: How to convert spaces to tabs and tabs to spaces

January 7, 2014

“Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio“, courtesy of ‘Sara Ford’

Sara Ford’s Blog

There are four commands that involve converting spaces to tabs and tabs to spaces. The first two commands are found on the Edit–Advanced menu:

  • Tabify Selected Lines Replaces the leading white space on a line that contains the selection with tabs.
  • Untabify Selected Lines Replaces the leading white space on a line that contains the selection with spaces.

Note

The Edit–Advanced–(Un)Tabify Selected Lines isn’t supported for Microsoft Visual Basic.

The last two commands are not found on the Edit menu but are available for you to either bind to a keyboard shortcut or manually add to the Edit menu or Text Editor toolbar:

  • Edit.ConvertTabsToSpaces Converts selected white space to spaces.
  • Edit.ConvertSpacesToTabs Converts selected white space to tabs.

Note that you may have to uncheck Tools–Options–Text Editor–Basic–VB Specific–Pretty Listing (Reformatting) of Code to use Edit.ConvertTabsToSpaces and Edit.ConvertSpacesToTabs.

Happy Programming! =)

Advertisements
Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: