[PATCH] Contrib: vim syntax, support block region

OOO othree at gmail.com
Wed Apr 19 09:52:36 UTC 2017


Hi Dounin

I have looked into your POC.
I use this approach in yajs.vim too.
The major problem of this approach is: It creates (sort of) redundant
syntax group.
For the listen directive:

> syn keyword ngxDirectiveImportantListen listen
>     \ nextgroup=@ngxListenParams skipwhite skipempty
> syn match ngxListenParam '\([^;{ \t\\]\|\\.\)\+'
>     \ contained
>     \ nextgroup=@ngxListenParams skipwhite skipempty
> syn region ngxListenString start=+\z(["']\)+ end=+\z1+ skip=+\\\\\|\\\z1+
>     \ contained
>     \ nextgroup=@ngxListenParams skipwhite skipempty
> syn match ngxListenComment '#.*$'
>     \ contained
>     \ nextgroup=@ngxListenParams skipwhite skipempty
> syn keyword ngxListenOptions contained
>     \ default_server ssl http2 spdy proxy_protocol
>     \ setfib fastopen backlog rcvbuf sndbuf accept_filter deferred bind
>     \ ipv6only reuseport so_keepalive keepidle
>     \ nextgroup=@ngxListenParams skipwhite skipempty
> syn cluster ngxListenParams
>     \ contains=ngxListenParam,ngxListenString,ngxListenComment
>     \ add=ngxListenOptions

The ngxListenParam, ngxListenString, ngxListenComment and
ngxListenParams are the redundant groups.
For every directive we want to highlight params.
We will have to add four more syntax group like this one.


More information about the nginx-devel mailing list