Greg Guida
Greg Guida

Reputation: 7512

Can I set tab with to 2 spaces in ruby and 4 spaces in javascript with sublime text

Pretty self explanatory, I just want to set up sublime to use 2 space indents for everything other than javascript

Upvotes: 19

Views: 8538

Answers (2)

Hubro
Hubro

Reputation: 59383

The accepted answer is unnecessarily complicated. Just open a Ruby file in Sublime Text 2, then:

Preferences -> Settings - More -> Syntax Specific - User

This will create a new file called Ruby.sublime-settings in the Packages/User directory and open it for you. If the file already exists it will just be opened for editing. Now you just need to type in your preferred settings and save.

Upvotes: 48

Liam Cain
Liam Cain

Reputation: 13373

Yes. You can create syntax specific settings files. Make a file named Javascript.sublime-settings and save it in Packages/Javascript.

Then add:

{
  "tab_size": 4,
  "translate_tabs_to_spaces": true
}

For more information, check out the this page from the docs: http://readthedocs.org/docs/sublime-text-unofficial-documentation/en/latest/customization/settings.html

Upvotes: 27

Related Questions