rebelliard
rebelliard

Reputation: 9611

Have Sublime 2 replace tabs with 4 spaces in Python but 2 spaces in JavaScript?

As the title suggests, I'm trying to set variable tab-for-space replacements according to the file format. Is this possible? I've only been able to set one universal setting for this.

Upvotes: 2

Views: 666

Answers (1)

celeritas
celeritas

Reputation: 2281

Open up a file of the format you want to set preferences for and do the following:

Click Sublime Text 2 -> Preferences -> Settings - More -> Syntax Specific - User

That will open a file for preferences for the format of the file you're editing; e.g., if you're editing a .c file, you'll be setting the preferences for C language files.

Add this to the file that Sublime Text opens after you navigate as above:

{ "tab_size": <whatever you want>, "translate_tabs_to_spaces": true }

Upvotes: 6

Related Questions