Syntax settings in sublime-project settings file

The sublime-settings file sets the parameters for each project:

{ "folders": [ ... ] "settings": { "tab_size": 4 } } 

How can I use special syntax settings in this file, for example, to set tab_size out of 2 only for *.js files?

+6
source share
2 answers

You cannot set exclusive language settings directly in your user Preferences.sublime-settings file. However, when editing a file of a certain type, you can create a settings file limited only by this type using the menu item Preferences -> Settingsโ€“More -> Syntax Specific โ€“ User .

This new file will appear in your Packages/User directory with a name that matches its language, for example. Markdown.sublime-settings will be a specific Markdown settings file.

+3
source

You can check . editorconfig .

Basically the .editorconfig file will look like this:

 # editorconfig.org # top-most EditorConfig file root = true # Unix-style newlines with a newline ending every file [*] end_of_line = lf insert_final_newline = true # Matches multiple files with brace expansion notation # Set default charset [*.{js,py}] charset = utf-8 # 4 space indentation [*.py] indent_style = space indent_size = 4 # Tab indentation (no size specified) [Makefile] indent_style = tab # Indentation override for all JS under lib directory [lib/**.js] indent_style = space indent_size = 2 # Matches the exact files either package.json or .travis.yml [{package.json,.travis.yml}] indent_style = space indent_size = 2 

There's even a good Sublime Text package that automatically reads and understands them. Just drop your .editorconfig into version control and you're ready to go.

+4
source

Source: https://habr.com/ru/post/957823/


All Articles