Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] Contrib: update vim syntax script

Maxim Dounin
February 17, 2017 10:26AM
Hello!

On Thu, Feb 16, 2017 at 11:57:35PM +0800, OOO wrote:

> Hi
>
> This patch improves vim syntax file for nginx conf.
>
> Major changes:
>
> * Fix regexp in string might breaks location ngxBlock
> * Use syntax iskeyword instead of modify real Vim iskeyword (new Vim
> feature, can avoid change user behavior)
> * Update keywords, based on document[1][2]
> * Add/Update all 3rd party module keywords based on wiki[3][4]
>
> Full change history is on github[5].
>
> [1]:https://nginx.org/en/docs/
> [2]:https://github.com/othree/nginx-contrib-vim/issues/4
> [3]:https://www.nginx.com/resources/wiki/modules/
> [4]:https://github.com/othree/nginx-contrib-vim/issues/1
> [5]:https://github.com/othree/nginx-contrib-vim
>
> # HG changeset patch
> # User othree <othree@gmail.com>
> # Date 1487259832 -28800
> # Thu Feb 16 23:43:52 2017 +0800
> # Node ID 3f74fe213e98697c932b20b86dfdaab505a8f89b
> # Parent 05fd0dc8f0dc808219f727dd18a5da2f078c4073
> Update contrib/vim/syntax
>
> * Fix regexp in string might breaks location ngxBlock
> * Highlight rewrite flags
> * Update keywords based on latest document
> * Include all 3rd party modules listed on wiki
> * Use syntax iskeyword instead of modify iskeyword

Thank you for the patch. Unfortunately, it fails to apply here,
as it was word-wrapped by your mail client. Please consider using "hg
email" to make sure the patch won't be corrupted in transit, see
http://nginx.org/en/docs/contributing_changes.html.

Note well that it would be much better to submit separate patches
for different changes.

Some additional comments below.

> -setlocal iskeyword+=.
> -setlocal iskeyword+=/
> -setlocal iskeyword+=:
> +if has("patch-7.4-1142")
> + if has("win32")
> + syn iskeyword @,48-57,_,128-167,224-235,.,/,:
> + else
> + syn iskeyword @,48-57,_,192-255,.,/,:
> + endif
> +else
> + setlocal iskeyword+=.
> + setlocal iskeyword+=/
> + setlocal iskeyword+=:
> +endif

Is it at all needed? As far as I see, syntax highliting doesn't
directly depends on keyword chars, so it might be better idea to just
remove iskeyword modifications. It will have some negative
effects by incorrectly matching directives in some file paths,
for example:

error_log /path/to/error_log;

will have "error_log" highlighted in the path, but this is
something already happens on "-" in a configuration like:

error_log /path/to/foo-error_log;

So probably this isn't something serious enough to worry about,
and just removing iskeyword modifications may be a better option.

If you think it is really needed, it might be a better idea to use
something like

if has("patch-7.4-1142")
exe "syn iskeyword ".&iskeyword.",.,/,:"
else
...
endif

(Seen at https://github.com/vim/vim/blob/master/runtime/syntax/sh.vim#L91).

[...]

> +" Asynchronous FastCGI Module https://github.com/rsms/afcgi
> +" Primarily a modified version of the Nginx FastCGI module which
> implements multiplexing of connections, allowing a single FastCGI
> server to handle many concurrent requests.
> +" syn keyword ngxDirectiveThirdParty fastcgi_bind
> +" syn keyword ngxDirectiveThirdParty fastcgi_buffer_size
> +" syn keyword ngxDirectiveThirdParty fastcgi_buffers
> +" syn keyword ngxDirectiveThirdParty fastcgi_busy_buffers_size
> +" syn keyword ngxDirectiveThirdParty fastcgi_cache
> +" syn keyword ngxDirectiveThirdParty fastcgi_cache_key
> +" syn keyword ngxDirectiveThirdParty fastcgi_cache_methods
> +" syn keyword ngxDirectiveThirdParty fastcgi_cache_min_uses
> +" syn keyword ngxDirectiveThirdParty fastcgi_cache_path
> +" syn keyword ngxDirectiveThirdParty fastcgi_cache_use_stale
> +" syn keyword ngxDirectiveThirdParty fastcgi_cache_valid
> +" syn keyword ngxDirectiveThirdParty fastcgi_catch_stderr
> +" syn keyword ngxDirectiveThirdParty fastcgi_connect_timeout
> +" syn keyword ngxDirectiveThirdParty fastcgi_hide_header
> +" syn keyword ngxDirectiveThirdParty fastcgi_ignore_client_abort
> +" syn keyword ngxDirectiveThirdParty fastcgi_ignore_headers
> +" syn keyword ngxDirectiveThirdParty fastcgi_index
> +" syn keyword ngxDirectiveThirdParty fastcgi_intercept_errors
> +" syn keyword ngxDirectiveThirdParty fastcgi_max_temp_file_size
> +" syn keyword ngxDirectiveThirdParty fastcgi_next_upstream
> +" syn keyword ngxDirectiveThirdParty fastcgi_param
> +" syn keyword ngxDirectiveThirdParty fastcgi_pass
> +" syn keyword ngxDirectiveThirdParty fastcgi_pass_header
> +" syn keyword ngxDirectiveThirdParty fastcgi_pass_request_body
> +" syn keyword ngxDirectiveThirdParty fastcgi_pass_request_headers
> +" syn keyword ngxDirectiveThirdParty fastcgi_read_timeout
> +" syn keyword ngxDirectiveThirdParty fastcgi_send_lowat
> +" syn keyword ngxDirectiveThirdParty fastcgi_send_timeout
> +" syn keyword ngxDirectiveThirdParty fastcgi_split_path_info
> +" syn keyword ngxDirectiveThirdParty fastcgi_store
> +" syn keyword ngxDirectiveThirdParty fastcgi_store_access
> +" syn keyword ngxDirectiveThirdParty fastcgi_temp_file_write_size
> +" syn keyword ngxDirectiveThirdParty fastcgi_temp_path
> +syn keyword ngxDirectiveThirdParty fastcgi_upstream_fail_timeout
> +syn keyword ngxDirectiveThirdParty fastcgi_upstream_max_fails

This module seems to be a (likely non-working) copy of stock
fastcgi module with no additional features. It provides no
additional directives. The fastcgi_upstream_fail_timeout /
fastcgi_upstream_max_fails directives you've listed here are long
deprecated and will only print result in an error (including in
this module).

[...]

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

[PATCH] Contrib: update vim syntax script

OOO 601 February 16, 2017 11:00AM

Re: [PATCH] Contrib: update vim syntax script

Maxim Dounin 234 February 17, 2017 10:26AM

Re: [PATCH] Contrib: update vim syntax script

OOO 235 February 19, 2017 11:28PM

Re: [PATCH] Contrib: update vim syntax script

Maxim Dounin 247 February 20, 2017 09:40AM

Re: [PATCH] Contrib: update vim syntax script

Maxim Dounin 184 February 20, 2017 10:22AM

Re: [PATCH] Contrib: update vim syntax script

OOO 200 February 20, 2017 10:36AM

Re: [PATCH] Contrib: update vim syntax script

Maxim Dounin 195 February 20, 2017 11:10AM

Re: [PATCH] Contrib: update vim syntax script

OOO 200 February 20, 2017 10:26AM



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

Online Users

Guests: 173
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready