Thursday, January 17, 2013

Basic Editor Settings - Tabs and Spaces

Use TABs rather than Spaces


Using TABS can eliminate many unnecessary code merges.

By using TABs, each developer can adjust their IDE to however many spaces of indentation they prefer.  One TAB = one scope of logic, whether it be the main block, an additional indention for a while loop, etc.  This keeps everyone's code consistent and accommodating for each person's indentation preferences.

Consider configuring a git hook to automatically applying this formatting rule before pushing any code to your remote repository.

TextMate


In the bottom of the document window >> Click Tab Size and select 4.
In the bottom of the document window >> Click Tab Size and select Hard Tabs

Convert existing Spaces to Tabs

Select all text in current document.
Main Menu | Text | Convert | Spaces to Tabs

RubyMine and IntelliJ

Preferences | Code Style | General >> Check Use tab character
Preferences | Code Style | General >> Set Tab size and Indent to 4

There is a setting in IntelliJ that will auto-format a document upon each save.









Sponsor Ads


1 comment:

  1. It is nice blog Thank you porovide important information and i am searching for same information to save my time Ruby on Rails Online Training

    ReplyDelete