forked from facelessuser/ApplySyntax
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApplySyntax.sublime-settings
executable file
·208 lines (204 loc) · 8.28 KB
/
ApplySyntax.sublime-settings
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
{
// If an exception occurs when processing a function, should it be reraised
// so the user gets feedback? This is really only useful to those writing
// functions. The average user just wants the plugin to work, so let's not reraise
// the exception
"reraise_exceptions": true,
// 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/JavaScript'.
"new_file_syntax": false,
// Auto add extensions to language settings file in User folder.
// Do not manually remove "ApplySyntax.ext-list" from the User folder
// as it is used to track which extensions ApplySyntax added so
// they can be removed later if needed.
// "extenstions" are ignored by "match": "all" setting.
"add_exts_to_lang_settings": true,
// Control level of logging in the console.
// (true|false|"verbose")
"debug": true,
"default_syntaxes": [
{
// The MXML rules come before the generic XML rules because they
// need syntax highlighting for the CDATA sections, but they do not
// have any characteristics that distinguish themselves from XML
// aside from their file extension
"syntax": "MXML",
"extensions": ["mxml"]
},
{
// I put XML next 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": "XML/XML",
"extensions": ["xml.dist"],
"rules": [
{"first_line": "^<\\?xml"}
]
},
{
// The Cucumber and RSpec rules come before Rails and Ruby because they end
// in .rb and will be identified as Rails or Ruby otherwise.
"syntax": "Cucumber/Cucumber Steps",
"rules": [
{"file_path": ".*steps\\.rb$"}
]
},
{
// One could use just the second rule to match every ruby file in a /spec/
// directory, but I prefer to be more explicit.
"syntax": [
"RSpec/RSpec",
"RSpec (snippets and syntax)/Syntaxes/RSpec",
"Better RSpec/Better RSpec"
],
"rules": [
{"file_path": ".*spec\\.rb$"},
{"file_path": ".*/spec/.*\\.rb$"},
{"file_path": ".*\\\\spec\\\\.*\\.rb$"}
]
},
{
// Will make .html.erb as HTML files
"syntax": "Rails/HTML (Rails)",
"extensions": ["html.erb"]
},
{
"syntax": "Rails/Ruby Haml",
"extensions": ["haml"]
},
{
// This is an example of using a custom function to decide whether or
// not to apply this syntax. The source file should be in a plugin folder.
// "name" is the function name and "source" is the file in which the
// function is contained. The rule should be specified as such.
"syntax": "Rails/Ruby on Rails",
"rules": [
{"function": {"source": "ApplySyntax.as_plugins.is_rails_file"}}
]
},
{
"syntax": "Ruby/Ruby",
"extensions": ["thor", "rake", "simplecov", "jbuilder", "rb", "podspec", "rabl"],
"rules": [
{"file_path": ".*(\\\\|/)Gemfile$"},
{"file_path": ".*(\\\\|/)Capfile$"},
{"file_path": ".*(\\\\|/)Guardfile$"},
{"file_path": ".*(\\\\|/)[Rr]akefile$"},
{"file_path": ".*(\\\\|/)Berksfile$"},
{"file_path": ".*(\\\\|/)[Cc]heffile$"},
{"file_path": ".*(\\\\|/)Thorfile$"},
{"file_path": ".*(\\\\|/)Podfile$"},
{"file_path": ".*(\\\\|/)config.ru$"},
{"file_path": ".*\\\\Vagrantfile(\\\\..*)?$"},
{"file_path": ".*/Vagrantfile(/..*)?$"},
// Interpreter is a short hand way of doing:
// {"first_line": "^#\\!(?:.+)ruby"}
{"interpreter": "ruby"}
]
},
// {
// // This is an example of using a contains rule to match files which
// // contain the specified string anywhere inside them. It's useful when
// // you can only determine which syntax to use by looking at what's
// // actually inside the file. In this case, since the file contains a
// // handlebar template, we switch its syntax highlighting to Handlebars.
// // Because I worry about performance, it is disabled by default.
// "syntax": "Handlebars/Handlebars",
// "match": "all",
// "rules": [
// {"file_path": ".*\\.html$"},
// {"contains": "<script [^>]*type=\"text\\/x-handlebars\"[^>]*>"}
// ]
// },
{
// Meteor templates follow Handlebars syntax, but must end in .html; but they also always begin with `<template name=`
"syntax": "Handlebars/Handlebars",
"match": "all",
"rules": [
{"file_path": ".*\\.html$"},
{"first_line": "^<template name="}
]
},
{
// Emblem syntax matches Ruby Slim
"syntax": "Ruby Slim/Syntaxes/Ruby Slim",
"extensions": ["emblem"]
},
{
"syntax": "Blade/Blade",
"extensions": ["blade.php"]
},
{
"syntax": "PHP/PHP",
"extensions": ["php3", "php4", "php5", "inc", "phtml"],
"rules": [
{"first_line": "^<\\?php"}
]
},
{
"syntax": "PHP/Smarty",
"extensions": ["tpl"]
},
{
"syntax": "YAML/YAML",
"extensions": [".gemrc", "yml", "yml.dist"]
},
{
// This rule requires the INI plugin to be installed (via Package Control
// or https://github.com/clintberry/sublime-text-2-ini)
"syntax": "INI/INI",
"extensions": [".gitattributes", ".gitconfig", ".gitignore", "ini.dist", ".npmrc"],
"rules": [
{"file_path": ".*/git/(attributes|config|ignore)$"},
{"file_path": ".*\\\\git\\\\(attributes|config|ignore)$"}
]
},
{
"syntax": "ShellScript/Shell-Unix-Generic",
"extensions": ["bash", "sh", "zsh"],
"rules": [
{"file_path": "profile"},
{"file_path": ".*\\.bash.*$"},
{"file_path": ".*\\.z(shrc|shenv|profile|login|logout).*$"},
{"interpreter": "bash"},
{"interpreter": "zsh"}
]
},
{
// Sublime recognizes .py files, but not if they don't have an extension,
// just a shebang
"syntax": "Python/Python",
"extensions": ["py3", "pyw"],
"rules": [
{"interpreter": "python"}
]
},
{
"syntax": "JavaScript/JSON",
"extensions": [".jshintrc", ".jscsrc", ".csslintrc", ".eslintrc", ".bowerrc"]
},
{
// .m files could be Objective-C or Matlab files
// We first use a rather reliable regex from GitHub
// https://github.com/github/linguist/blob/master/lib/linguist/heuristics.rb#L69)
// to apply syntax for Objective-C files
"syntax": "Objective-C/Objective-C",
"match": "all",
"rules": [
{"file_path": ".*\\.m$"},
{"contains": "^\\s*(@(interface|class|protocol|property|end|synchronised|selector|implementation)\\b|#import\\s+.+\\.h[\">])"}
]
},
{
// Then use the % regex to detect Matlab files
"syntax": "Matlab/Matlab",
"match": "all",
"rules": [
{"file_path": ".*\\.m$"},
{"contains": "(^|\n)\\s*%"}
]
}
]
}