Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text 3 tab size per file type?

How do I configure the Sublime Text 3 settings so that a specific file type has its own tab size? I want ruby to 2 tab size, python = 4, C++ = 4, etc. How do I do this without manually doing so every time?

like image 535
Beast_Code Avatar asked Mar 11 '15 01:03

Beast_Code


People also ask

How do I change the tab size in Sublime Text 3?

To configure the tab width in Sublime Text 3, click on “View” in the top bar, then click on “Indentation” in the drop-down list. Next, in the second level of the drop-down list select the width you want a tab to take up. Sublime Text 3 defaults to tabs being four spaces wide.

How do I fix Sublime spacing?

"cmd+f" => " "(two spaces) => "alt+enter" => "arrow right" => " "(two more spaces) => set tab width to 4(this can be done before or after. On windows or other platforms change cmd+f and alt+enter with whatever your find and select all hotkeys are.

How do I change the default indentation in Sublime Text 3?

Changing default indentation settings The following File Type Preferences determine the indentation settings: translateTabsToSpaces: set to either 'true' or 'false'. If true, then when tab is pressed, an equivalent number of spaces will be inserted into the buffer instead. Defaults to false.

How do I indent in Sublime Text?

Select all code that you intend to indent, then hit Ctrl + ] in Sublime text to indent. For macOS users, use command + ] to indent, and command + [ to un-indent.


1 Answers

Do the following for each file-type:

1- Go to

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

Note: Might change slightly depending on your OS

2- Sublime-Text will open a file for editing, check the filename: should be called something like Python.sublime-settings.

3- Add the following content to the file and save it.

{     "tab_size": 4 } 
like image 171
JuanR Avatar answered Sep 28 '22 08:09

JuanR