Different Indentation on Different Languages in Sublime Text

While writing programs in pyopencl, we should face the indentation of python and CL. According to the coding convention, python uses 4 spaces as the indentation and C uses 2 spaces as the indentation. So, we may want to configure our IDE to have different indentation on different programming languages.

As a user of Sublime Text, I found that the Syntax Specific is the correct place to configure it. If we want to configure C to use 2 spaces as its default indentation, we can do the followings:

  1. Open/create a C file
  2. Open Syntax Specific at Preferences -> Settings-More -> Syntax Specific
  3. use the following content as the opened file which should be C++.sublime-settings:
  "tab_size": 2,
  "translate_tabs_to_spaces": true

It's so cool to have that.