Skip to content

Commit 7724cfc

Browse files
committed
nginx support update
copied from Arch's nginx package
1 parent b530bfe commit 7724cfc

File tree

4 files changed

+61
-11
lines changed

4 files changed

+61
-11
lines changed

ftdetect/nginx.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
au BufRead,BufNewFile *.nginx set ft=nginx
2+
au BufRead,BufNewFile */etc/nginx/* set ft=nginx
3+
au BufRead,BufNewFile */usr/local/nginx/conf/* set ft=nginx
4+
au BufRead,BufNewFile nginx.conf set ft=nginx

indent/nginx.vim

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
if exists("b:did_indent")
2+
finish
3+
endif
4+
let b:did_indent = 1
5+
6+
setlocal indentexpr=
7+
8+
" cindent actually works for nginx' simple file structure
9+
setlocal cindent
10+
" Just make sure that the comments are not reset as defs would be.
11+
setlocal cinkeys-=0#

scripts.vim

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ if expand('%:t') =~? '^rfc\d\+'
55
setfiletype rfc
66
finish
77
endif
8-
if expand('%:p') =~ '\vnginx.*(conf|sites).*'
9-
setfiletype nginx
10-
finish
11-
endif
128
if expand('%:t') =~ '^\v\.?magic$'
139
setfiletype magic
1410
finish

syntax/nginx.vim

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ setlocal iskeyword+=.
99
setlocal iskeyword+=/
1010
setlocal iskeyword+=:
1111

12-
syn match ngxVariable '\$\w\w*'
13-
syn match ngxVariableBlock '\$\w\w*' contained
14-
syn match ngxVariableString '\$\w\w*' contained
15-
syn region ngxBlock start=+^+ end=+{+ contains=ngxComment,ngxDirectiveBlock,ngxVariableBlock,ngxString oneline
16-
syn region ngxString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=ngxVariableString oneline
17-
syn region ngxString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=ngxVariableString oneline
18-
syn match ngxComment '\s*#.*$'
12+
syn match ngxVariable '\$\(\w\+\|{\w\+}\)'
13+
syn match ngxVariableBlock '\$\(\w\+\|{\w\+}\)' contained
14+
syn match ngxVariableString '\$\(\w\+\|{\w\+}\)' contained
15+
syn region ngxBlock start=+^+ end=+{+ skip=+\${+ contains=ngxComment,ngxDirectiveBlock,ngxVariableBlock,ngxString oneline
16+
syn region ngxString start=+\z(["']\)+ end=+\z1+ skip=+\\\\\|\\\z1+ contains=ngxVariableString
17+
syn match ngxComment ' *#.*$'
1918

2019
syn keyword ngxBoolean on
2120
syn keyword ngxBoolean off
@@ -643,6 +642,46 @@ syn keyword ngxDirectiveThirdParty xss_get
643642
syn keyword ngxDirectiveThirdParty xss_input_types
644643
syn keyword ngxDirectiveThirdParty xss_output_type
645644

645+
" uWSGI Module <http://wiki.nginx.org/HttpUwsgiModule>
646+
" Allows Nginx to interact with uWSGI processes and control what parameters are passed to the process.
647+
syn keyword ngxDirectiveThirdParty uwsgi_bind
648+
syn keyword ngxDirectiveThirdParty uwsgi_buffer_size
649+
syn keyword ngxDirectiveThirdParty uwsgi_buffering
650+
syn keyword ngxDirectiveThirdParty uwsgi_buffers
651+
syn keyword ngxDirectiveThirdParty uwsgi_busy_buffers_size
652+
syn keyword ngxDirectiveThirdParty uwsgi_cache
653+
syn keyword ngxDirectiveThirdParty uwsgi_cache_bypass
654+
syn keyword ngxDirectiveThirdParty uwsgi_cache_key
655+
syn keyword ngxDirectiveThirdParty uwsgi_cache_lock
656+
syn keyword ngxDirectiveThirdParty uwsgi_cache_lock_timeout
657+
syn keyword ngxDirectiveThirdParty uwsgi_cache_methods
658+
syn keyword ngxDirectiveThirdParty uwsgi_cache_min_uses
659+
syn keyword ngxDirectiveThirdParty uwsgi_cache_path
660+
syn keyword ngxDirectiveThirdParty uwsgi_cache_use_stale
661+
syn keyword ngxDirectiveThirdParty uwsgi_cache_valid
662+
syn keyword ngxDirectiveThirdParty uwsgi_connect_timeout
663+
syn keyword ngxDirectiveThirdParty uwsgi_hide_header
664+
syn keyword ngxDirectiveThirdParty uwsgi_ignore_client_abort
665+
syn keyword ngxDirectiveThirdParty uwsgi_ignore_headers
666+
syn keyword ngxDirectiveThirdParty uwsgi_intercept_errors
667+
syn keyword ngxDirectiveThirdParty uwsgi_max_temp_file_size
668+
syn keyword ngxDirectiveThirdParty uwsgi_modifier1
669+
syn keyword ngxDirectiveThirdParty uwsgi_modifier2
670+
syn keyword ngxDirectiveThirdParty uwsgi_next_upstream
671+
syn keyword ngxDirectiveThirdParty uwsgi_no_cache
672+
syn keyword ngxDirectiveThirdParty uwsgi_param
673+
syn keyword ngxDirectiveThirdParty uwsgi_pass
674+
syn keyword ngxDirectiveThirdParty uwsgi_pass_header
675+
syn keyword ngxDirectiveThirdParty uwsgi_pass_request_body
676+
syn keyword ngxDirectiveThirdParty uwsgi_pass_request_headers
677+
syn keyword ngxDirectiveThirdParty uwsgi_read_timeout
678+
syn keyword ngxDirectiveThirdParty uwsgi_send_timeout
679+
syn keyword ngxDirectiveThirdParty uwsgi_store
680+
syn keyword ngxDirectiveThirdParty uwsgi_store_access
681+
syn keyword ngxDirectiveThirdParty uwsgi_string
682+
syn keyword ngxDirectiveThirdParty uwsgi_temp_file_write_size
683+
syn keyword ngxDirectiveThirdParty uwsgi_temp_path
684+
646685
" highlight
647686

648687
hi link ngxComment Comment

0 commit comments

Comments
 (0)