Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] Contrib: vim syntax, support block region

OOO
March 10, 2017 11:46AM
Hi Dounin

Do you have any idea about this implementation for ngxBlock.
If you think this approach is ok.
I will keep going in this direction.
And send more robust(maybe) patch later.



2017-03-04 19:59 GMT+08:00 othree <othree@gmail.com>:
> # HG changeset patch
> # User othree <othree@gmail.com>
> # Date 1488628696 -28800
> # Sat Mar 04 19:58:16 2017 +0800
> # Node ID a244d5f635ebf90cd30c42f826810b9bf5d53f3c
> # Parent 7fca6f60d5cafa0127b5bc4d6b74fcd06ab532a3
> Contrib: vim syntax, support block region.
>
> diff --git a/contrib/vim/syntax/nginx.vim b/contrib/vim/syntax/nginx.vim
> --- a/contrib/vim/syntax/nginx.vim
> +++ b/contrib/vim/syntax/nginx.vim
> @@ -4,43 +4,66 @@
> if exists("b:current_syntax")
> finish
> end
>
> setlocal iskeyword+=.
> setlocal iskeyword+=/
> setlocal iskeyword+=:
>
> -syn match ngxVariable '\$\(\w\+\|{\w\+}\)'
> -syn match ngxVariableBlock '\$\(\w\+\|{\w\+}\)' contained
> -syn match ngxVariableString '\$\(\w\+\|{\w\+}\)' contained
> -syn region ngxBlock start=+^+ end=+{+ skip=+\${+ contains=ngxComment,ngxDirectiveBlock,ngxVariableBlock,ngxString oneline
> -syn region ngxString start=+[^:a-zA-Z>!\\@]\z(["']\)+lc=1 end=+\z1+ skip=+\\\\\|\\\z1+ contains=ngxVariableString
> -syn match ngxComment ' *#.*$'
> +syn match ngxVariable '\$\(\w\+\|{\w\+}\)'
> +syn match ngxVariableString '\$\(\w\+\|{\w\+}\)' contained
> +
> +syn region ngxString start=+\%(^\|\s\)\zs\z(["']\)+ end=+\z1+ skip=+\\\\\|\\\z1+ contains=ngxVariableString
> +syn region ngxComment start=+\%(^\|\s\)\zs#+ end=+$+ oneline
>
> syn keyword ngxBoolean on
> syn keyword ngxBoolean off
>
> -syn keyword ngxDirectiveBlock http contained
> -syn keyword ngxDirectiveBlock mail contained
> -syn keyword ngxDirectiveBlock events contained
> -syn keyword ngxDirectiveBlock server contained
> -syn keyword ngxDirectiveBlock types contained
> -syn keyword ngxDirectiveBlock location contained
> -syn keyword ngxDirectiveBlock upstream contained
> -syn keyword ngxDirectiveBlock charset_map contained
> -syn keyword ngxDirectiveBlock limit_except contained
> -syn keyword ngxDirectiveBlock if contained
> -syn keyword ngxDirectiveBlock geo contained
> -syn keyword ngxDirectiveBlock map contained
> -syn keyword ngxDirectiveBlock split_clients contained
> +syn match ngxDirectiveBlockParams /\S\+/ contains=ngxVariableString contained nextgroup=ngxDirectiveBlockParams,ngxBlock skipwhite skipempty
> +syn match ngxDirectiveBlockParam1 /\S\+/ contains=ngxVariableString contained nextgroup=ngxDirectiveBlockParam2 skipwhite skipempty
> +syn match ngxDirectiveBlockParam2 /\S\+/ contains=ngxVariableString contained nextgroup=ngxBlock skipwhite skipempty
> +syn region ngxDirectiveBlockParams start=+\%(^\|\s\)\zs\z(["']\)+ end=+\z1+ skip=+\\\\\|\\\z1+ contains=ngxVariableString contained nextgroup=ngxDirectiveBlockParams,ngxBlock skipwhite skipempty
> +syn region ngxDirectiveBlockParam1 start=+\%(^\|\s\)\zs\z(["']\)+ end=+\z1+ skip=+\\\\\|\\\z1+ contains=ngxVariableString contained nextgroup=ngxDirectiveBlockParam2 skipwhite skipempty
> +syn region ngxDirectiveBlockParam2 start=+\%(^\|\s\)\zs\z(["']\)+ end=+\z1+ skip=+\\\\\|\\\z1+ contains=ngxVariableString contained nextgroup=ngxBlock skipwhite skipempty
> +
> +syn cluster ngxDirectives contains=ngxDirectiveBlock,ngxDirectiveImportant,ngxDirectiveControl,ngxDirectiveError,ngxDirectiveDeprecated,ngxDirective,ngxDirectiveThirdParty
> +syn cluster ngxBlockDirectives contains=@ngxDirectives,ngxReservedMainContextDirective
> +syn cluster ngxBlockElements contains=@ngxBlockDirectives,ngxVariable,ngxString,ngxComment,ngxBoolean
> +
> +syn region ngxBlock start=+{+ end=+}+ contained contains=@ngxBlockElements
> +syn region ngxServerBlock start=+{+ end=+}+ contained contains=@ngxBlockElements,ngxReservedServerContextDirective
> +syn region ngxUpstreamBlock start=+{+ end=+}+ contained contains=@ngxBlockElements,ngxDirectiveServer
> +
> +syn keyword ngxDirectiveBlock http nextgroup=ngxBlock skipwhite skipempty
> +syn keyword ngxDirectiveBlock mail nextgroup=ngxBlock skipwhite skipempty
> +syn keyword ngxDirectiveBlock events nextgroup=ngxBlock skipwhite skipempty
> +syn keyword ngxDirectiveBlock server nextgroup=ngxServerBlock skipwhite skipempty
> +syn keyword ngxDirectiveBlock types nextgroup=ngxBlock skipwhite skipempty
> +
> +syn match ngxLocationPath /\S\+/ contained nextgroup=ngxBlock skipwhite skipempty
> +syn region ngxLocationPath start=+\%(^\|\s\)\zs\z(["']\)+lc=1 end=+\z1+ skip=+\\\\\|\\\z1+ contains=ngxVariableString contained nextgroup=ngxBlock skipwhite skipempty
> +syn match ngxLocationOperator /\(=\|\~\*\|\^\~\|\~\)/ contained nextgroup=ngxLocationPath skipwhite skipempty
> +syn match ngxLocationNamedLoc /@\w\+/
> +syn keyword ngxDirectiveBlock location nextgroup=ngxLocationNamedLoc,ngxLocationOperator,ngxLocationPath,ngxString skipwhite skipempty
> +
> +syn keyword ngxDirectiveBlock upstream nextgroup=ngxUpstreamBlock skipwhite skipempty
> +syn keyword ngxDirectiveBlock charset_map nextgroup=ngxDirectiveBlockParam1 skipwhite skipempty
> +syn keyword ngxDirectiveBlock limit_except nextgroup=ngxDirectiveBlockParams skipwhite skipempty
> +syn keyword ngxDirectiveBlock if nextgroup=ngxBlock skipwhite skipempty
> +syn keyword ngxDirectiveBlock geo nextgroup=ngxBlock skipwhite skipempty
> +syn keyword ngxDirectiveBlock map nextgroup=ngxDirectiveBlockParam1 skipwhite skipempty
> +syn keyword ngxDirectiveBlock split_clients nextgroup=ngxDirectiveBlockParam1 skipwhite skipempty
> +
> +syn keyword ngxReservedMainContextDirective http contained
> +syn keyword ngxReservedServerContextDirective server contained
>
> syn keyword ngxDirectiveImportant include
> syn keyword ngxDirectiveImportant root
> -syn keyword ngxDirectiveImportant server
> +syn keyword ngxDirectiveServer server contained
> syn keyword ngxDirectiveImportant server_name
> syn keyword ngxDirectiveImportant listen contained
> syn region ngxDirectiveImportantListen matchgroup=ngxDirectiveImportant start=+listen+ skip=+\\\\\|\\\;+ end=+;+he=e-1 contains=ngxListenOptions,ngxString
> syn keyword ngxDirectiveImportant internal
> syn keyword ngxDirectiveImportant proxy_pass
> syn keyword ngxDirectiveImportant memcached_pass
> syn keyword ngxDirectiveImportant fastcgi_pass
> syn keyword ngxDirectiveImportant scgi_pass
> @@ -2118,24 +2141,26 @@ syn keyword ngxDirectiveThirdParty xss_i
> " ZIP Module https://www.nginx.com/resources/wiki/modules/zip/
> " ZIP archiver for nginx
>
>
> " highlight
>
> hi link ngxComment Comment
> hi link ngxVariable Identifier
> -hi link ngxVariableBlock Identifier
> hi link ngxVariableString PreProc
> -hi link ngxBlock Normal
> hi link ngxString String
> +hi link ngxLocationOperator Operator
> +hi link ngxLocationPath String
> +hi link ngxLocationNamedLoc Identifier
>
> hi link ngxBoolean Boolean
> hi link ngxDirectiveBlock Statement
> hi link ngxDirectiveImportant Type
> +hi link ngxDirectiveServer ngxDirectiveImportant
> hi link ngxDirectiveControl Keyword
> hi link ngxDirectiveError Constant
> hi link ngxDirectiveDeprecated Error
> hi link ngxDirective Identifier
> hi link ngxDirectiveThirdParty Special
>
> hi link ngxListenOptions Keyword
> hi link ngxMailProtocol Keyword



--
OOO
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH 1 of 4] Contrib: vim syntax, allow multiline config by skipempty

othree 685 March 03, 2017 05:58AM

[PATCH 3 of 4] Contrib: vim syntax, highlight HTTP status code

othree 334 March 03, 2017 05:58AM

[PATCH 2 of 4] Contrib: vim syntax, highlight rewrite flag

othree 311 March 03, 2017 05:58AM

[PATCH 4 of 4] Contrib: vim syntax, remove unecessary ngxBlock

othree 279 March 03, 2017 05:58AM

Re: [PATCH 4 of 4] Contrib: vim syntax, remove unecessary ngxBlock

Maxim Dounin 277 March 03, 2017 09:06AM

Re: [PATCH 4 of 4] Contrib: vim syntax, remove unecessary ngxBlock

OOO 329 March 03, 2017 10:40AM

Re: [PATCH 4 of 4] Contrib: vim syntax, remove unecessary ngxBlock

Maxim Dounin 329 March 03, 2017 12:26PM

[PATCH] Contrib: vim syntax, support block region

othree 336 March 04, 2017 07:00AM

Re: [PATCH] Contrib: vim syntax, support block region

OOO 329 March 10, 2017 11:46AM

Re: [PATCH] Contrib: vim syntax, support block region

Maxim Dounin 308 March 10, 2017 11:54AM

Re: [PATCH] Contrib: vim syntax, support block region

OOO 287 March 10, 2017 11:58AM

Re: [PATCH] Contrib: vim syntax, support block region

OOO 276 April 19, 2017 05:54AM

Re: [PATCH] Contrib: vim syntax, support block region

Maxim Dounin 243 April 19, 2017 11:12AM

Re: [PATCH] Contrib: vim syntax, support block region

OOO 251 April 21, 2017 04:40AM

Re: [PATCH] Contrib: vim syntax, support block region

Maxim Dounin 321 April 21, 2017 09:48AM

Re: [PATCH 4 of 4] Contrib: vim syntax, remove unecessary ngxBlock

OOO 341 March 04, 2017 07:20AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 121
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready