Skip to content

Commit 099b415

Browse files
author
john muhl
committed
Initial commit, includes basic language grammar
0 parents  commit 099b415

File tree

4 files changed

+283
-0
lines changed

4 files changed

+283
-0
lines changed

README

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Features
2+
========
3+
4+
* Language grammar
5+
* folding
6+
* highlighting
7+
* `log` tab completion for setting up logs in NCSA combined format (the same as Apache's combined log format)
8+
9+
Language grammar
10+
================
11+
12+
This is my first attempt at any kind of language grammar for TextMate, so don't expect intensely satisfying code completion or anything like that. At least not for a while. Right now all you get are a few scopes you can use to add some style to your nginx configuration files; and very basic code folding, it only folds between { and } and then probably not all the time if you format your code tremendously differently than I do. The grammar is basically still just a keyword highlighter for nicer looking files.
13+
14+
Scopes
15+
======
16+
17+
* source.nginx
18+
19+
* module.events
20+
* module.http
21+
* directive.module.main
22+
* directive.module.events
23+
* directive.module.http
24+
* directive.module.http.upstream
25+
* directive.module.http.access
26+
* directive.module.http.auth_basic
27+
* directive.module.http.autoindex
28+
* directive.module.http.browser
29+
* directive.module.http.charset
30+
* directive.module.http.empty_gif
31+
* directive.module.http.fastcgi
32+
* directive.module.http.geo
33+
* directive.module.http.gzip
34+
* directive.module.http.headers
35+
* directive.module.http.referer
36+
* directive.module.http.limit_zone
37+
* directive.module.http.log
38+
* directive.module.http.map
39+
* directive.module.http.memcached
40+
* directive.module.http.proxy
41+
* directive.module.http.rewrite
42+
* directive.module.http.ssi
43+
* directive.module.http.userid
44+
* comment
45+
* brace
46+
* paren
47+
* regex
48+
* end

Snippets/log_format.tmSnippet

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>content</key>
6+
<string>log_format ncsacombo '\$remote_addr - \$remote_user [\$time_local] "\$request" \$status \$body_bytes_sent "\$http_referer" "\$http_user_agent"';</string>
7+
<key>name</key>
8+
<string>log_format</string>
9+
<key>scope</key>
10+
<string>source.nginx</string>
11+
<key>tabTrigger</key>
12+
<string>log</string>
13+
<key>uuid</key>
14+
<string>4A6DFEAF-2A69-42EF-AEBA-479B46A29399</string>
15+
</dict>
16+
</plist>

Syntaxes/nginx.tmLanguage

+205
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>fileTypes</key>
6+
<array>
7+
<string>conf</string>
8+
</array>
9+
<key>foldingStartMarker</key>
10+
<string>\{\s*$</string>
11+
<key>foldingStopMarker</key>
12+
<string>^\s*\}</string>
13+
<key>keyEquivalent</key>
14+
<string>^~N</string>
15+
<key>name</key>
16+
<string>nginx</string>
17+
<key>patterns</key>
18+
<array>
19+
<dict>
20+
<key>match</key>
21+
<string>\#.*</string>
22+
<key>name</key>
23+
<string>comment</string>
24+
</dict>
25+
<dict>
26+
<key>match</key>
27+
<string>\b(events)\b</string>
28+
<key>name</key>
29+
<string>module.events</string>
30+
</dict>
31+
<dict>
32+
<key>match</key>
33+
<string>\b(http)\b</string>
34+
<key>name</key>
35+
<string>module.http</string>
36+
</dict>
37+
<dict>
38+
<key>match</key>
39+
<string>\{|\}</string>
40+
<key>name</key>
41+
<string>brace</string>
42+
</dict>
43+
<dict>
44+
<key>match</key>
45+
<string>\;</string>
46+
<key>name</key>
47+
<string>end</string>
48+
</dict>
49+
<dict>
50+
<key>match</key>
51+
<string>\b(daemon|env|debug_points|error_log|log_not_found|include|lock_file|master_process|pid|ssl_engine|timer_resolution|user|worker_cpu_affinity|worker_priority|worker_processes|worker_rlimit_core|worker_rlimit_nofile|worker_rlimit_sigpending|working_directory)\b</string>
52+
<key>name</key>
53+
<string>directive.module.main</string>
54+
</dict>
55+
<dict>
56+
<key>match</key>
57+
<string>\b(accept_mutex|accept_mutex_delay|debug_connection|devpoll_changes|devpoll_events|epoll_events|kqueue_changes|kqueue_events|multi_accept|rtsig_signo|rtsig_overflow_events|rtsig_overfl|ow_testrtsig_overflow_threshold|use|worker_connections)\b</string>
58+
<key>name</key>
59+
<string>directive.module.events</string>
60+
</dict>
61+
<dict>
62+
<key>match</key>
63+
<string>\b(alias|client_body_in_file_only|client_body_buffer_size|client_body_temp_path|client_body_timeout|client_header_buffer_size|client_header_timeout|client_max_body_size|default_type|error_page|index|internal|keepalive_timeout|large_client_header_buffers|limit_except|limit_rate|listen|location|msie_padding|msie_refresh|optimize_server_names|port_in_redirect|recursive_error_pages|root|satisfy_any|send_timeout|sendfile|server|server_name|server_names_hash_max_size|server_names_hash_bucket_size|tcp_nodelay|tcp_nopush)\b|[^.]\b(types)\b</string>
64+
<key>name</key>
65+
<string>directive.module.http</string>
66+
</dict>
67+
<dict>
68+
<key>match</key>
69+
<string>\b(ip_hash|upstream|server)\b</string>
70+
<key>name</key>
71+
<string>directive.module.http.upstream</string>
72+
</dict>
73+
<dict>
74+
<key>match</key>
75+
<string>\b(allow|deny)\b</string>
76+
<key>name</key>
77+
<string>directive.module.http.access</string>
78+
</dict>
79+
<dict>
80+
<key>match</key>
81+
<string>\b(auth_basic|auth_basic_user_file)\b</string>
82+
<key>name</key>
83+
<string>directive.module.http.auth_basic</string>
84+
</dict>
85+
<dict>
86+
<key>match</key>
87+
<string>\b(autoindex|autoindex_exact_size|autoindex_localtime)\b</string>
88+
<key>name</key>
89+
<string>directive.module.http.autoindex</string>
90+
</dict>
91+
<dict>
92+
<key>match</key>
93+
<string>\b(ancient_browser|ancient_browser_value|modern_browser|modern_browser_value)\b</string>
94+
<key>name</key>
95+
<string>directive.module.http.browser</string>
96+
</dict>
97+
<dict>
98+
<key>match</key>
99+
<string>\b(charset|charset_map|override_charset|source_charset)\b</string>
100+
<key>name</key>
101+
<string>directive.module.http.charset</string>
102+
</dict>
103+
<dict>
104+
<key>match</key>
105+
<string>\b(empty_gif)\b</string>
106+
<key>name</key>
107+
<string>directive.module.http.empty_gif</string>
108+
</dict>
109+
<dict>
110+
<key>match</key>
111+
<string>\b(fastcgi_index|fastcgi_hide_header|fastcgi_ignore_client_abort|fastcgi_intercept_errors|fastcgi_param|fastcgi_pass|fastcgi_pass_header|fastcgi_read_timeout|fastcgi_redirect_errors|fa|stcgi_storefastcgi_store_access|fastcgi_buffers|fastcgi_buffers_size|fastcgi_temp_path)\b</string>
112+
<key>name</key>
113+
<string>directive.module.http.fastcgi</string>
114+
</dict>
115+
<dict>
116+
<key>match</key>
117+
<string>\b(geo)\b</string>
118+
<key>name</key>
119+
<string>directive.module.http.geo</string>
120+
</dict>
121+
<dict>
122+
<key>match</key>
123+
<string>\b(gzip|gzip_buffers|gzip_comp_level|gzip_disable|gzip_http.version|gzip_min_length|gzip_proxied|gzip_types|gzip_vary)\b</string>
124+
<key>name</key>
125+
<string>directive.module.http.gzip</string>
126+
</dict>
127+
<dict>
128+
<key>match</key>
129+
<string>\b(add_header|expires|server_tokens)\b</string>
130+
<key>name</key>
131+
<string>directive.module.http.headers</string>
132+
</dict>
133+
<dict>
134+
<key>match</key>
135+
<string>\b(valid_referers)\b</string>
136+
<key>name</key>
137+
<string>directive.module.http.referer</string>
138+
</dict>
139+
<dict>
140+
<key>match</key>
141+
<string>\b(limit_zone|limit_conn)\b</string>
142+
<key>name</key>
143+
<string>directive.module.http.limit_zone</string>
144+
</dict>
145+
<dict>
146+
<key>match</key>
147+
<string>\b(access_log|log_format)\b</string>
148+
<key>name</key>
149+
<string>directive.module.http.log</string>
150+
</dict>
151+
<dict>
152+
<key>match</key>
153+
<string>\b(map|map_hash_max_size|map_hash_bucket_size)\b</string>
154+
<key>name</key>
155+
<string>directive.module.http.map</string>
156+
</dict>
157+
<dict>
158+
<key>match</key>
159+
<string>\b(memcached_pass|memcached_connect_timeout|memcached_send_timeout|memcached_read_timeout|memcached_buffer_size|memcached_next_upstream)\b</string>
160+
<key>name</key>
161+
<string>directive.module.http.memcached</string>
162+
</dict>
163+
<dict>
164+
<key>match</key>
165+
<string>\b(proxy_buffer_size|proxy_buffering|proxy_buffers|proxy_busy_buffers_size|proxy_connect_timeout|proxy_headers_hash_bucket_size|proxy_headers_hash_max_size|proxy_hide_header|proxy_ign|ore_client_abortproxy_intercept_errors|proxy_max_temp_file_size|proxy_method|proxy_next_upstream|proxy_pass|proxy_pass_header|proxy_pass_request_body|proxy_pass_request_headers|proxy_|redirectproxy_read_timeout|proxy_redirect|proxy_redirect_errors|proxy_send_lowat|proxy_send_timeout|proxy_set_body|proxy_set_header|proxy_store|proxy_store_access|proxy_temp_file_write_size|proxy_t|emp_pathproxy_upstream_fail_timeout|proxy_upstream_max_fails)\b</string>
166+
<key>name</key>
167+
<string>directive.module.http.proxy</string>
168+
</dict>
169+
<dict>
170+
<key>match</key>
171+
<string>\b(break|if|return|rewrite|set|uninitialized_variable_warn)\b</string>
172+
<key>name</key>
173+
<string>directive.module.http.rewrite</string>
174+
</dict>
175+
<dict>
176+
<key>match</key>
177+
<string>\b(ssi|ssi_silent_errors|ssi_types|ssi_value_length)\b</string>
178+
<key>name</key>
179+
<string>directive.module.http.ssi</string>
180+
</dict>
181+
<dict>
182+
<key>match</key>
183+
<string>\b(userid|userid_domain|userid_expires|userid_name|userid_p3p|userid_path|userid_service)\b</string>
184+
<key>name</key>
185+
<string>directive.module.http.userid</string>
186+
</dict>
187+
<dict>
188+
<key>match</key>
189+
<string>\(.*\)</string>
190+
<key>name</key>
191+
<string>paren</string>
192+
</dict>
193+
<dict>
194+
<key>match</key>
195+
<string>\\.*\ |\~|\~\*|\!\~|\!\~\*</string>
196+
<key>name</key>
197+
<string>regex</string>
198+
</dict>
199+
</array>
200+
<key>scopeName</key>
201+
<string>source.nginx</string>
202+
<key>uuid</key>
203+
<string>41998851-319E-4F6A-A398-31D7F98F84A3</string>
204+
</dict>
205+
</plist>

info.plist

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>name</key>
6+
<string>nginx</string>
7+
<key>ordering</key>
8+
<array>
9+
<string>41998851-319E-4F6A-A398-31D7F98F84A3</string>
10+
</array>
11+
<key>uuid</key>
12+
<string>D9EBF868-395B-4AB7-8970-0EAECDA961C4</string>
13+
</dict>
14+
</plist>

0 commit comments

Comments
 (0)