Vim Tips Wiki
(add some context and backlink)
(standard format)
Line 1: Line 1:
  +
{{ScriptComments|1886|nginx: highlight configuration files for nginx web server}}
== Comments, bugs, improvements to syntax script [http://www.vim.org/scripts/script.php?script_id=1886 nginx.vim] ==
 
 
=== Patch to 0.3.1 fixes comment detection ===
 
   
 
==Patch to 0.3.1 fixes comment detection==
 
This patch fixes comment detection. Instead of just looking at space characters, it considers all whitespace before a # character. (You can probably edit the one-character change easier than you could apply the patch file.)
 
This patch fixes comment detection. Instead of just looking at space characters, it considers all whitespace before a # character. (You can probably edit the one-character change easier than you could apply the patch file.)
  +
<pre>
 
--- nginx.vim
 
+++ nginx.vim
 
@@ -15,7 +15,7 @@
 
syn region ngxBlock start=+^+ end=+{+ contains=ngxDirectiveBlock,ngxVariableBlock,ngxString oneline
 
syn region ngxString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=ngxVariableString oneline
 
syn region ngxString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=ngxVariableString oneline
 
-syn match ngxComment ' *#.*$'
 
+syn match ngxComment '\W*#.*$'
  +
 
syn keyword ngxBoolean on
 
syn keyword ngxBoolean off
  +
</pre>
   
  +
==Comments==
--- nginx.vim
 
+++ nginx.vim
 
@@ -15,7 +15,7 @@
 
syn region ngxBlock start=+^+ end=+{+ contains=ngxDirectiveBlock,ngxVariableBlock,ngxString oneline
 
syn region ngxString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=ngxVariableString oneline
 
syn region ngxString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=ngxVariableString oneline
 
-syn match ngxComment ' *#.*$'
 
+syn match ngxComment '\W*#.*$'
 
 
syn keyword ngxBoolean on
 
syn keyword ngxBoolean off
 

Revision as of 11:39, 11 June 2010

Use this page to discuss script 1886 1886

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on vim.org).
  • This page may be out of date: check the script's vim.org page above, and its release notes.

Patch to 0.3.1 fixes comment detection

This patch fixes comment detection. Instead of just looking at space characters, it considers all whitespace before a # character. (You can probably edit the one-character change easier than you could apply the patch file.)

--- nginx.vim
+++ nginx.vim
@@ -15,7 +15,7 @@
 syn region ngxBlock start=+^+ end=+{+ contains=ngxDirectiveBlock,ngxVariableBlock,ngxString oneline
 syn region ngxString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=ngxVariableString oneline
 syn region ngxString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=ngxVariableString oneline
 -syn match ngxComment ' *#.*$'
 +syn match ngxComment '\W*#.*$'

 syn keyword ngxBoolean on
 syn keyword ngxBoolean off

Comments