Sublime Forum

[Solved] My "Indention Rules.tmPreference" does'nt work

#1

I’ve made “Indention Rules.tmPreference” for the scripting language AutoIt.
Here is it:

[code]<?xml version="1.0" encoding="UTF-8"?>

name Indentation Rules scope source.autoit increaseIndentPattern ^\s*(?i:case|do|for|func|then|else|elseif|while|select|switch|with).*$ decreaseIndentPattern ^\s*(?i:case|else|endif|elseif|endfunc|endselect|endswitch|next|until|wend|endwith).*$ uuid e1c07276-203b-46ee-8a53-a19dbe687a1a [/code] But it takes no effect. Can anyone explain me what is to do that this works?
0 Likes

#2

You do indentation rules in JSON format for specific syntaxes. docs.sublimetext.info/en/latest/ … e-settings

Example:

This is in a HTML.sublime-settings file.

{
    "tab_size": 2,
}
0 Likes

#3

The indention related settings in *.sublime-settings file has no relations to special rules. There are only defined how to indent, but not when. So works it with the default behaviour: Next line has the same indent level like the current line.
Therefore, there is the * .tmPreference. Its also the same for comments. This file is created the same way as a theme file (as a JSON file and then converted to plist). The used scope names are correct. ST works with all scopes from TextMate.
It may be, that some settings in environment must be changed too. But nowhere I’ve found an tutorial for this problem. :neutral_face:

Edit:
Now I’ve solved it by another way: Key bindings

[code]
…,
{ “keys”: “enter”], “command”: “insert”, “args”: {“characters”: “\n\t”}, “context”:

        { "key": "setting.auto_indent", "operator": "equal", "operand": true },
        { "key": "preceding_text", "operator": "regex_contains", "operand": "(?i:case|do|for|func|then|else|elseif|while|select|switch|with)", "match_all": true },
        { "key": "selector", "operator": "equal", "operand": "source.autoit" }
    ]
},
...

][/code]
But Thanks for reading my post. :wink:

0 Likes