Difference between revisions of "How to set up tab spaces"
m (→notepad++ should be 2 spaces) |
(→XCode: - updated to reflect differences in XCode 4) |
||
(One intermediate revision by the same user not shown) | |||
Line 52: | Line 52: | ||
+ | <br /> | ||
+ | |||
+ | ==XCode== | ||
+ | |||
+ | |||
+ | <i>If you're using a Mac (or Hackintosh), you're most likely using XCode. It can be a little tricky to find the Preferences for indentation, but other than that, it isn't a pain to set up tabs.</i> | ||
+ | |||
+ | ===XCode 3=== | ||
+ | <ol> | ||
+ | <li>Within XCode, select Preferences from the main menu or press <b>Command-,</b>.</li> | ||
+ | <li>Under the tabs, you'll find a left-right scroll bar. Scroll right and select Indentation.</li> | ||
+ | <li>Under Tabs, check "Tab key inserts tabs, not spaces.</li> | ||
+ | <li>In the Tab width field, enter 2.</li> | ||
+ | <li>In the Indent width field, enter 2.</li> | ||
+ | </ol> | ||
+ | |||
+ | ===XCode 4=== | ||
+ | <ol> | ||
+ | <li>Within XCode, select Preferences from the main menu or press <b>Command-,</b>.</li> | ||
+ | <li>Select Text Editing tab. Click Indentation</li> | ||
+ | <li>In the Tab width field, enter 2.</li> | ||
+ | <li>In the Indent width field, enter 2.</li> | ||
+ | <li>You may like to indent wrapped lines by 2 spaces.</li> | ||
+ | </ol> | ||
<br /> <br /> <br /> | <br /> <br /> <br /> |
Latest revision as of 12:46, 30 November 2011
This page will describe how to set up certain IDEs and Text Editors to not use the default tab character (\t) when the Tab key is pressed and instead use a predefined number of regular space characters instead. This is useful because when importing/exporting to different editors and/or platforms these tab characters can be read differently causing code to not be displayed in it's original intended form
Notepad++ v5.6.6
This part uses Notepad++ v5.6.6 to set up tab spaces. Other versions should still be similar.
To change the default action of the tab key:
- Click on the Settings menu
- Select Preferences
- Go to the Language Menu/Tab Settings tab
- Make sure [Default] is selected in the rightmost list
- At The bottom right, click the blue underlined number beside the Tab size:
- Press 2, and press enter
- Check Replace by space
- Click Close
This should set up all newly opened documents to insert 2 spaces when the Tab key is pressed instead of the default \t.
Visual Studio
Comfirmed to work for Visual Studio 2008/2010. Should be the same for 2005 aswell
To change the default action of the tab key:
- Click on the Tools menu
- Select Options...
- Click the + beside Text Editor
- Click the + beside All Languages (or whatever language you want)
- Select Tabs
- Set Indenting to Smart
- Type 2 for both Tab size: and Indent size:
- Select the Insert spaces radio button
- Press Ok
This should set up all newly opened documents to insert 3 spaces when the Tab key is pressed instead of the default \t.
Komodo Edit
Figured I would add this one in here because it was introduced to us by John Samuel during the 2010 Summer semester, for those of you taking INT322 as well.
- Open up Preferences. On mac it's simply Command+, (literally just hold command and the comma key) and on PC, well hopefully someone can edit to confirm but I imagine it's along the lines of control+p.
- Click on the arrow beside Editor to bring down the further categories for it.
- Select Indentation.
- Simply enter the desired number of spaces for indents in the appropriate window and hit OK at the bottom.
Feel free to edit it obviously if there are any major things I got or differences for Komodo on Windows.
XCode
If you're using a Mac (or Hackintosh), you're most likely using XCode. It can be a little tricky to find the Preferences for indentation, but other than that, it isn't a pain to set up tabs.
XCode 3
- Within XCode, select Preferences from the main menu or press Command-,.
- Under the tabs, you'll find a left-right scroll bar. Scroll right and select Indentation.
- Under Tabs, check "Tab key inserts tabs, not spaces.
- In the Tab width field, enter 2.
- In the Indent width field, enter 2.
XCode 4
- Within XCode, select Preferences from the main menu or press Command-,.
- Select Text Editing tab. Click Indentation
- In the Tab width field, enter 2.
- In the Indent width field, enter 2.
- You may like to indent wrapped lines by 2 spaces.