commit ab3e509f2587c239ece4fbe743aed213d3b44d4b Author: hnagato Date: Mon Mar 10 20:52:00 2014 +0900 initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..7268d0d --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# Nginx syntax support in Atom + +Adds syntax highlighting and snippet support to Nginx configuration files. +Ported from [textmate/nginx](https://github.com/johnmuhl/nginx-tmbundle) for Atom. diff --git a/grammars/nginx.cson b/grammars/nginx.cson new file mode 100644 index 0000000..72aa780 --- /dev/null +++ b/grammars/nginx.cson @@ -0,0 +1,145 @@ +'fileTypes': [ + 'conf' +] +'foldingStartMarker': '\\{\\s*$' +'foldingStopMarker': '^\\s*\\}' +'name': 'nginx' +'patterns': [ + { + 'match': '\\#.*' + 'name': 'comment' + } + { + 'match': '[0-9]' + 'name': 'constant.numeric' + } + { + 'match': '\\{|\\}' + 'name': 'constant.character.brace' + } + { + 'match': '\\;' + 'name': 'constant.character.end' + } + { + 'match': '\\(|\\)' + 'name': 'constant.character.paren' + } + { + 'match': '\\"' + 'name': 'constant.character.quote' + } + { + 'match': '\\\\.*\\ |\\~|\\~\\*|\\!\\~|\\!\\~\\*' + 'name': 'string.regexp' + } + { + 'match': '\\"(.*)\\"' + 'name': 'string.quoted' + } + { + 'match': '\\\'(.*)\\\'' + 'name': 'string.quoted' + } + { + 'match': '\\b(events)\\b' + 'name': 'constant.language.module.events' + } + { + 'match': '\\b^(http)\\b' + 'name': 'constant.language.module.http' + } + { + 'match': '\\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' + 'name': 'constant.language.directive.module.main' + } + { + 'match': '\\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_overflow_test|rtsig_overflow_threshold|use|worker_connections)\\b' + 'name': 'constant.language.directive.module.events' + } + { + 'match': '\\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|types\\ )\\b' + 'name': 'constant.language.directive.module.http' + } + { + 'match': '\\b(allow|deny)\\b' + 'name': 'constant.language.module.http.access' + } + { + 'match': '\\b(auth_basic|auth_basic_user_file)\\b' + 'name': 'constant.language.module.http.auth_basic' + } + { + 'match': '\\b(autoindex|autoindex_exact_size|autoindex_localtime)\\b' + 'name': 'constant.language.module.http.autoindex' + } + { + 'match': '\\b(ancient_browser|ancient_browser_value|modern_browser|modern_browser_value)\\b' + 'name': 'constant.language.module.http.browser' + } + { + 'match': '\\b(charset|charset_map|override_charset|source_charset)\\b' + 'name': 'constant.language.module.http.charset' + } + { + 'match': '\\b(empty_gif)\\b' + 'name': 'constant.language.module.http.empty_gif' + } + { + 'match': '\\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' + 'name': 'constant.language.module.http.fastcgi' + } + { + 'match': '\\b(geo)\\b' + 'name': 'constant.language.module.http.geo' + } + { + 'match': '\\b(gzip|gzip_buffers|gzip_comp_level|gzip_disable|gzip_http.version|gzip_min_length|gzip_proxied|gzip_types|gzip_vary)\\b' + 'name': 'constant.language.module.http.gzip' + } + { + 'match': '\\b(add_header|expires|server_tokens)\\b' + 'name': 'constant.language.module.http.headers' + } + { + 'match': '\\b(valid_referers)\\b' + 'name': 'constant.language.module.http.referer' + } + { + 'match': '\\b(limit_zone|limit_conn)\\b' + 'name': 'constant.language.module.http.limit_zone' + } + { + 'match': '\\b(access_log|log_format)\\b' + 'name': 'constant.language.module.http.log' + } + { + 'match': '\\b(map|map_hash_max_size|map_hash_bucket_size)\\b' + 'name': 'constant.language.module.http.map' + } + { + 'match': '\\b(memcached_pass|memcached_connect_timeout|memcached_send_timeout|memcached_read_timeout|memcached_buffer_size|memcached_next_upstream)\\b' + 'name': 'constant.language.module.http.memcached' + } + { + 'match': '\\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' + 'name': 'constant.language.module.http.proxy' + } + { + 'match': '\\b(break|if|return|reqrite|set|uninitialized_variable_warn)\\b' + 'name': 'constant.language.module.http.rewrite' + } + { + 'match': '\\b(ssi|ssi_silent_errors|ssi_types|ssi_value_length)\\b' + 'name': 'constant.language.module.http.ssi' + } + { + 'match': '\\b(ip_hash|upstream|server)\\b' + 'name': 'constant.language.module.http.upstream' + } + { + 'match': '\\b(userid|userid_domain|userid_expires|userid_name|userid_p3p|userid_path|userid_service)\\b' + 'name': 'constant.language.module.http.userid' + } +] +'scopeName': 'source.nginx' diff --git a/package.json b/package.json new file mode 100644 index 0000000..f62edbd --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "name": "language-nginx", + "version": "0.0.0", + "description": "Syntax and snippet support for Nginx configuration files", + "repository": "https://github.com/hnagato/atom-language-nginx", + "license": "MIT", + "engines": { + "atom": ">0.50.0" + }, + "dependencies": { + } +} diff --git a/scoped-properties/language-nginx.cson b/scoped-properties/language-nginx.cson new file mode 100644 index 0000000..72ca909 --- /dev/null +++ b/scoped-properties/language-nginx.cson @@ -0,0 +1,3 @@ +'.source.nginx': + 'editor': + 'commentStart': '# ' diff --git a/snippets/language-nginx.cson b/snippets/language-nginx.cson new file mode 100644 index 0000000..71ca746 --- /dev/null +++ b/snippets/language-nginx.cson @@ -0,0 +1,4 @@ +'.source.nginx': + 'log_format': + 'prefix': 'log' + 'body': 'log_format ncsacombo \'\\$remote_addr - \\$remote_user [\\$time_local] "\\$request" \\$status \\$body_bytes_sent "\\$http_referer" "\\$http_user_agent"\';'