Skip to content

Instantly share code, notes, and snippets.

@mtbdeano
Last active August 29, 2015 14:27
Show Gist options
  • Save mtbdeano/5321a8155b431efb3ed6 to your computer and use it in GitHub Desktop.
Save mtbdeano/5321a8155b431efb3ed6 to your computer and use it in GitHub Desktop.
Sublime Text - Apply Syntax - Rules for flask Jinja2 templates and Elastic Beanstalk Extensions
{
// If you want exceptions reraised so you can see them in the console, change this to true.
"reraise_exceptions": false,
// If you want to have a syntax applied when new files are created, set new_file_syntax to the name of the syntax to use.
// The format is exactly the same as "syntax" in the rules below. For example, if you want to have a new file use
// JavaScript syntax, set new_file_syntax to 'JavaScript'.
"new_file_syntax": false,
// Auto add extensions to language settings file in User folder.
// Do not manually remove "apply_syntax_extensions" from the settings file.
// "extenstions" are ignored by "match": "all" setting.
"add_exts_to_lang_settings": true,
// Control level of logging in the console.
// (true|false|"verbose")
"debug": false,
// Put your custom syntax rules here:
"syntaxes": [
{
// I put XML first because of files like *.tmLanguage. It is unlikely
// that this rule will result in a false positive, meaning if it
// matches, you probably want the XML syntax
"syntax": "YAML/YAML",
"rules": [
{"file_path": ".*\\/\\.ebextensions\\/.*\\.config"}
]
},
{
"syntax": "Jinja2/Syntaxes/HTML (Jinja Templates)",
"rules": [
{"file_path": ".*\\/templates\\/.*\\.html"}
]
}
]
}
@mtbdeano
Copy link
Author

The trick in this file is the name of the Jinja2 syntax! It was hard to find: to find Jinja2/Syntaxes/HTML (Jinja Templates) you need to change the .tmPackage into a .zip file, extracting contents, then find the path!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment