Add /src/vim/release.sh, a script to compile and install vim
[msysgit.git] / share / vim / vim58 / doc / syntax.txt
blob8d86524e09c35aaa2b309dee03d14f9815f89c9b
1 *syntax.txt*    For Vim version 5.8.  Last change: 2001 May 15
4                   VIM REFERENCE MANUAL    by Bram Moolenaar
7 Syntax highlighting             *syntax* *syntax-highlighting* *coloring*
9 Syntax highlighting enables the possibility to show parts of the text in
10 another font or color.  Those parts can be specific keywords or text
11 matching a pattern.  Vim doesn't parse the whole file (to keep it fast), so
12 the highlighting has its limitations.  Lexical highlighting might be a
13 better name, but everybody calls it syntax highlighting, so we'll stick with
14 that.
16 Vim supports syntax highlighting on all terminals.  But since most ordinary
17 terminals have very limited highlighting possibilities, it works best in the
18 GUI version, gvim.
20 1.  Quick start                 |:syn-qstart|
21 2.  Syntax files                |:syn-files|
22 3.  Syntax loading procedure    |syntax-loading|
23 4.  Syntax file remarks         |:syn-file-remarks|
24 5.  Defining a syntax           |:syn-define|
25 6.  :syntax arguments           |:syn-arguments|
26 7.  Syntax patterns             |:syn-pattern|
27 8.  Syntax clusters             |:syn-cluster|
28 9.  Including syntax files      |:syn-include|
29 10. Synchronizing               |:syn-sync|
30 11. Listing syntax items        |:syntax|
31 12. Highlight command           |:highlight|
32 13. Linking groups              |:highlight-link|
33 14. Cleaning up                 |:syn-clear|
34 15. Highlighting tags           |tag-highlight|
35 16. Color xterms                |xterm-color|
37 {Vi does not have any of these commands}
39 The syntax highlighting is not available when the |+syntax| feature has been
40 disabled at compile time.
42 ==============================================================================
43 1. Quick start                                          *:syn-qstart*
45                                                         *:syn-on*
46 For a large number of common languages syntax files have been included.  To
47 start using them, type this command:
48 >  :syntax on
50 This will enable automatic syntax highlighting.  The type of highlighting will
51 be selected using the file name extension, and sometimes using the first line
52 of the file.
54 Include this command in your .vimrc if you always want syntax highlighting, or
55 put it in your .gvimrc if you only want it in the GUI.  If you don't want it
56 for B&W terminals, but you do want it for color terminals, put this in your
57 .vimrc:
58 >  if &t_Co > 1
59 >    syntax on
60 >  endif
62 What this command actually does, is executing the command
63 >  source $VIMRUNTIME/syntax/syntax.vim
64 If the VIM environment variable is not set, Vim will try to find
65 the path in another way (see |$VIMRUNTIME|).  Normally this will work just
66 fine.  If it doesn't, try setting the VIM environment variable to the
67 directory where the Vim stuff is located.  For example, if your syntax files
68 are in the "/usr/vim/vim50/syntax" directory, set $VIMRUNTIME to
69 "/usr/vim/vim50".  You must do this in the shell, before starting Vim.
71                                                         *:syn-default-override*
72 You can override the default highlight settings, by issuing ":highlight"
73 commands after sourcing "syntax.vim".  For example:
74 >  syntax on
75 >  highlight Constant gui=NONE guibg=grey95
77 This will change the GUI highlighting for the "Constant" group.  See
78 |:highlight| about how to specify highlighting attributes.
80                                                         *:hi-normal*
81 If you are running in the GUI, you can get white text on a black background
82 with:
83 >  highlight Normal guibg=Black guifg=White
84 For a color terminal see |:hi-normal-cterm|.
86 If you have a black background, use these commands to get better colors (see
87 'background'):
88 >  set background=dark
89 >  syntax on
91 NOTE: The syntax files on MS-DOS and Windows have lines that end in <CR><NL>.
92 The files for Unix end in <NL>.  This means you should use the right type of
93 file for your system.  Although on MS-DOS and Windows the right format is
94 automatically selected if the 'fileformats' option is not empty.
96 NOTE: When using reverse video ("gvim -fg white -bg black"), the default value
97 of 'background' will not be set until the GUI window is opened, which is after
98 reading the .gvimrc.  This will cause the wrong default highlighting to be
99 used.  To set the default value of 'background' before switching on
100 highlighting, include the ":gui" command in the .gvimrc:
102 >  :gui         " open window and set default for 'background'
103 >  :syntax on   " start highlighting, use 'background' to set colors
105 NOTE: Using ":gui" in the .gvimrc means that "gvim -f" won't start in the
106 foreground!  Use ":gui -f" then.
109 To switch off the syntax highlighting:                  *:syn-off*
110 >  :syntax off
111 This will completely disable syntax highlighting and remove it immediately for
112 all buffers.
114 You can toggle the syntax on/off with this command
115 >  :if exists("syntax_on") | syntax off | else | syntax on | endif
117 To put this into a mapping, you can use:
118 >  map <F7> :if exists("syntax_on") <Bar> syntax off <Bar> else <Bar> syntax on <Bar> endif <CR>
119 [using the |<>| notation, type this literally]
122 To make syntax highlighting work only in selected buffers:      *:syn-manual*
123 >   :syntax manual
124 This will enable the syntax highlighting, but not switch it on automatically
125 when starting to edit a buffer.  This is because the FileType autocommands are
126 not used to select a syntax.
128 Now you can still switch on syntax highlighting for a buffer by setting the
129 'syntax' option.  For example, to switch on fortran highlighting:
130 >   :set syntax=fortran
131 This can also be done with a |modeline|, so that files that include a modeline
132 that sets the 'syntax' option will be highlighted.  For example, this line can
133 be used in a Makefile:
134 >   # vim: syntax=make
136                                                         *syntax-printing*
137 If you want to print your colored text, you will have to convert it to HTML
138 first, and then print it from a browser.  See |2html.vim|.
141 Details
142 The ":syntax" commands are implemented by sourcing a file.  To see exactly how
143 this works, look in the file:
144     command             file ~
145     :syntax on          $VIMRUNTIME/syntax/syntax.vim
146     :syntax manual      $VIMRUNTIME/syntax/manual.vim
147     :syntax off         $VIMRUNTIME/syntax/nosyntax.vim
148 Also see |syntax-loading|.
150 ==============================================================================
151 2. Syntax files                                         *:syn-files*
153 The syntax and highlighting commands for one language are normally stored in
154 a syntax file.  The name convention is: "{name}.vim".  Where {name} is the
155 name of the language, or an abbreviation (to fit the name in 8.3 characters,
156 which is always done, in case the file will be used on a DOS filesystem).
157 Examples:
158         c.vim           perl.vim        java.vim        html.vim
159         cpp.vim         sh.vim          csh.vim
161 The syntax file can contain any Ex commands, just like a vimrc file.  But
162 the idea is that only commands for a specific language are included.  When a
163 language is a superset of another language, it may include the other one,
164 for example, the cpp.vim file could include the c.vim file:
165 >  :so $VIMRUNTIME/syntax/c.vim
167 The .vim files are normally loaded with an autocommand.  For example:
168 >  :au Syntax c     source $VIMRUNTIME/syntax/c.vim
169 >  :au Syntax cpp   source $VIMRUNTIME/syntax/cpp.vim
170 These commands are normally in the file $VIMRUNTIME/syntax/synload.vim.
173 MAKING YOUR OWN SYNTAX FILES                            *mysyntaxfile*
175 When you create your own syntax files, and you want to have these
176 automatically used with ":syntax on", do this:
178 1. Create a file that contains the autocommands to load your syntax files when
179    the right file type is detected.  To prevent loading two syntax files (when
180    the file type is used twice), first delete other autocommands for the same
181    file type.  You can also include ":highlight" commands in this file, which
182    override the normal highlighting (because the file is sourced after setting
183    the normal highlighting).  Example:
184 >    au! Syntax dosbatch    so ~/vim/batch.vim
185 >    au! Syntax mine        so ~/vim/mine.vim
186 >    highlight Comment gui=bold
187    Let's assume you write this file in "~/vim/mysyntax.vim".
189    Note that when you introduce a new file type, this must first be detected.
190    See |myfiletypefile|.
192                                                         *mysyntaxfile-file*
193 2. In your .vimrc, set the "mysyntaxfile" variable to the file you just
194    created.  For example:
195 >    let mysyntaxfile = "~/vim/mysyntax.vim"
196    Put this before ":syntax on"!
198 If you want to use a new file type, see |new-filetype|.
200 Note that "mysyntaxfile" is sourced AFTER defining the default autocommands
201 for the supplied syntax files, so that you can override these autocommands
202 with your own.
204 If you are setting up a system with many users, and you don't want each user
205 to add the same syntax file, consider creating a vimrc file that is used for
206 all everybody.  See |system-vimrc|.
209 ADDING TO AN EXISTING SYNTAX FILE                       *mysyntaxfile-add*
211 If you are mostly satisfied with an existing syntax file, but would like to
212 add a few items or change the highlighting, follow these steps:
214 1. In your vimrc file, set "mysyntaxfile":
215 >       let mysyntaxfile = "/home/someone/vim/mysyntax.vim"
217 2. In the "mysyntax.vim" file, put an autocommand to source your extra syntax
218    items:
219 >       " FooBar language
220 >       :autocmd Syntax foobar          source /home/someone/vim/foobar.vim
221    Check: if you do ":autocmd Syntax foobar" you wil see both the original
222    syntax file and the one you just added:
223 >       Syntax
224 >          foobar       so $VIMRUNTIME/syntax/foobar.vim
225 >          foobar       source /home/someone/vim/foobar.vim
227 3. In the additional language file, put the items you want to add:
228 >       syntax keyword foobarType       Short Long
229 >       hi link foobarType      Type
230 >       hi foobarComment guifg=Green
233 REPLACING AN EXISTING SYNTAX FILE                       *mysyntaxfile-replace*
235 If you don't like a distributed syntax file, or you have downloaded a new
236 version, follow the same steps as above, but at the second item add a "!" to
237 the autocmd:
238 >       " FooBar language
239 >       :autocmd! Syntax foobar         source /home/someone/vim/foobar.vim
240 Check: If you do ":autocmd Syntax foobar" you will only see the syntax file
241 you just added:
242 >       Syntax
243 >          foobar       source /home/someone/vim/foobar.vim
246 NAMING CONVENTIONS
247                                                         *group-name*
248 To be able to allow each user to pick his favorite set of colors, there need
249 to be preferred names for highlight groups that are common for many languages.
250 These are the ones that are suggested to be used:
252         *Comment        any comment
254         *Constant       any constant
255          String         a string constant: "this is a string"
256          Character      a character constant: 'c', '\n'
257          Number         a number constant: 234, 0xff
258          Boolean        a boolean constant: TRUE, false
259          Float          a floating point constant: 2.3e10
261         *Identifier     any variable name
262          Function       function name (also: methods for classes)
264         *Statement      any statement
265          Conditional    if, then, else, endif, switch, etc.
266          Repeat         for, do, while, etc.
267          Label          case, default, etc.
268          Operator       "sizeof", "+", "*", etc.
269          Keyword        any other keyword
270          Exception      try, catch, throw
272         *PreProc        generic Preprocessor
273          Include        preprocessor #include
274          Define         preprocessor #define
275          Macro          same as Define
276          PreCondit      preprocessor #if, #else, #endif, etc.
278         *Type           int, long, char, etc.
279          StorageClass   static, register, volatile, etc.
280          Structure      struct, union, enum, etc.
281          Typedef        A typedef
283         *Special        any special symbol
284          SpecialChar    special character in a constant
285          Tag            you can use CTRL-] on this
286          Delimiter      character that needs attention
287          SpecialComment special things inside a comment
288          Debug          debugging statements
290         *Ignore         left blank, hidden
292         *Error          any erroneous construct
294         *Todo           anything that needs extra attention; mostly the
295                         keywords TODO FIXME and XXX
297 The ones marked with * are the preferred groups, the other are minor groups.
298 For the preferred groups, the "syntax.vim" file contains default highlighting.
299 The minor groups are linked to the preferred groups, so they get the same
300 highlighting.  You can override these defaults by giving ":highlight" commands
301 after sourcing the "syntax.vim" file.
303 Note that highlight group names are not case sensitive.  "String" and "string"
304 can be used for the same group.
306 The following names are reserved and cannot be used as a group name:
307         NONE   ALL   ALLBUT   contains   contained
309 ==============================================================================
310 3. Syntax loading procedure                             *syntax-loading*
312 This explains the details that happen when the command ":syntax on" is issued.
313 When Vim initializes itself, it finds out where the runtime files are located.
314 This is used here as the variable |$VIMRUNTIME|.
316 What ":syntax on" does:
318     Source $VIMRUNTIME/syntax/syntax.vim
319     |
320     +-  Clear out any old syntax.
321     |
322     +-  Source $VIMRUNTIME/syntax/synload.vim
323     |   |
324     |   +-  Set up standard highlighting groups
325     |   |
326     |   +-  Set up syntax autocmds to load the appropriate syntax file when
327     |   |   the 'syntax' option is set. *synload-1*
328     |   |
329     |   +-  Source the user's optional file, from the |mysyntaxfile| variable.
330     |       This is where you can add your own syntax autocommands for loading
331     |       your syntax file when the 'syntax' option is set.  You can also
332     |       modify the standard highlighting here. *synload-2*
333     |
334     +-  Source $VIMRUNTIME/filetype.vim
335     |   |
336     |   +-  Install autocmds based on suffix to set the 'filetype' option
337     |   |   This is where the connection between file name and file type is
338     |   |   made for known file types. *synload-3*
339     |   |
340     |   +-  Source the user's optional file, from the |myfiletypefile|
341     |   |   variable.  This is where you can add your own connections between
342     |   |   file name and file type.  Or overrule existing ones. *synload-4*
343     |   |
344     |   +-  Install one autocommand which loads $VIMRUNTIME/scripts.vim when
345     |   |   no file type was detected yet. *synload-5*
346     |   |
347     |   +-  Source $VIMRUNTIME/menu.vim, to setup the Syntax menu. |menu.vim|
348     |
349     +-  Install a FileType autocommand to set the 'syntax' option when a file
350     |   type has been detected. *synload-6*
351     |
352     +-  Execute syntax autocommands to start syntax highlighting for each
353         already loaded buffer.
356 When a file is loaded, its syntax file is found in this way:
358     Loading the file triggers the BufReadPost autocommands.
359     |
360     +-  If there is a match with one of the autocommands from |synload-3|
361     |   (known file types) or |synload-4| (user's file types), the 'filetype'
362     |   option is set to the file type.
363     |
364     +-  The autocommand at |synload-5| is triggered.  If the file type was not
365     |   found yet, then $VIMRUNTIME/scripts.vim is sourced.
366     |   |
367     |   +-  Source the user's optional |myscriptsfile|.  This typically makes
368     |   |   checks using "getline(1) =~ pattern" to find out which file type
369     |   |   the file is, and sets 'filetype'.
370     |   |
371     |   +-  If the file type is still unknown, check the contents of the file,
372     |       again with checks like "getline(1) =~ pattern" as to whether the
373     |       file type can be recognized, and set 'filetype'.
374     |
375     +-  When the file type was determined and 'filetype' was set, this
376     |   triggers the FileType autocommand |synload-6| above.  It sets
377     |   'syntax' to the determined file type.
378     |
379     +-  When the 'syntax' option was set above, this triggers an autocommand
380     |   from |synload-1| or |synload-2|.  This will source the syntax file in
381     |   the $VIMRUNTIME/syntax directory or the user's syntax file.
382     |
383     +-  Any other user installed FileType or Syntax autocommands are
384         triggered.  This can be used to change the highlighting for a specific
385         syntax.
387 ==============================================================================
388 4. Syntax file remarks                                  *:syn-file-remarks*
390                                                 *b:current_syntax-variable*
391 The name of the syntax that has been loaded is stored in the
392 "b:current_syntax" variable.  You can use this if you want to load other
393 settings, depending on which syntax is active.  Example:
394 >  :au BufReadPost * if b:current_syntax == "csh"
395 >  :au BufReadPost *   do-some-things
396 >  :au BufReadPost * endif
399 2HTML                                           *2html.vim* *convert-to-HTML*
401 This is not a syntax file itself, but a script that converts the current
402 window into HTML.  A new window is opened, in which the HTML file is built.
403         Warning: This is slow!
404 The resulting file can be written where you want it.  You can then view it
405 with any HTML viewer, such as Netscape.  The colors should be exactly the same
406 as you see them in Vim.
407 If you want the lines to be numbered, set the "html_number_color" variable to
408 the color name of the line number.  The color name must be valid in HTML.
409 Example:
410 >   let html_number_color = "#804000"
411 To stop this, remove the variable:
412 >   unlet html_number_color
413 Remarks:
414 - This only works in a version with GUI support.  If the GUI not actually
415   running (possible for X11) it still works, but not that good (the color
416   names may be wrong).
417 - In older browsers the background colors will not be shown.
418 - From Netscape you can also print the file (in color)!
419 - When 'tabstop' is not 8, the amount of white space will be wrong.
421 Here is an example how to run the script over all .c and .h files from a
422 Unix shell:
423 >  $ for f in *.[ch]; do gvim -f +"syn on" +"so \$VIMRUNTIME/syntax/2html.vim" +"wq" +"q" $f; done
426 Ada                                             *ada.vim*
428 This mode is designed for the 1995 edition of Ada ("Ada95"), which includes
429 support for objected-programming, protected types, and so on.  It handles code
430 written for the original Ada language ("Ada83" or "Ada87") as well, though
431 Ada83 code which uses Ada95-only keywords will be wrongly colored (such code
432 should be fixed anyway).
433 For more information about Ada, see http://www.adapower.com.
435 The Ada mode handles a number of situations cleanly.  For example, it knows
436 that the "-" in "-5" is a number, but the same character in "A-5" is an
437 operator.  Normally, a "with" or "use" clause referencing another compilation
438 unit is colored the same way as C's "#include" is colored.  If you have
439 "Conditional" or "Repeat" groups colored differently, then "end if" and "end
440 loop" will be colored as part of those respective groups.
441 You can set these to different colors using vim's "highlight" command (e.g.,
442 to change how loops are displayed, enter the command ":hi Repeat" followed by
443 the color specification; on simple terminals the color specification
444 ctermfg=White often shows well).
446 There are several options you can select in this Ada mode.
447 To enable them, assign a value to the option.  For example, to turn one on:
448 >   let ada_standard_types = 1
449 To disable them use ":unlet".  Example:
450 >   unlet ada_standard_types = 1
451 You can just use ":" and type these into the command line to set these
452 temporarily before loading an Ada file.  You can make these option settings
453 permanent by adding the "let" command(s), without a colon,
454 to your "~/.vimrc" file.
456 Here are the Ada mode options:
458 Variable                 Action ~
459 ada_standard_types       Highlight types in package Standard (e.g., "Float")
460 ada_space_errors         Highlight extraneous errors in spaces...
461 ada_no_trail_space_error   but ignore trailing spaces at the end of a line
462 ada_no_tab_space_error     but ignore tabs after spaces
463 ada_withuse_ordinary     Show "with" and "use" as ordinary keywords
464                            (when used to reference other compilation units
465                            they're normally highlighted specially).
466 ada_begin_preproc        Show all begin-like keywords using the coloring
467                            of C preprocessor commands.
469 Even on a slow (90Mhz) PC this mode works quickly, but if you find
470 the performance unnacceptable, turn on ada_withuse_ordinary.
473 Assembly                *asm.vim* *asmh8300.vim* *nasm.vim* *masm.vim* *asm68k*
475 Files matching "*.i" could be Progress or Assembly  If the automatic detection
476 doesn't work for you, or you don't edit Progress at all, use this in your
477 startup vimrc:
478 >   :let filetype_i = "asm"
479 Replace "asm" with the type of assembly you use.
481 There are many types of assembly languages that all use the same file name
482 extensions.  Therefore you will have to select the type yourself, or add a
483 line in the assembly file that Vim will recognize.  Currently these syntax
484 files are included:
485         asm             GNU assembly (the default)
486         asm68k          Motorola 680x0 assembly
487         asmh8300        Hitachi H-8300 version of GNU assembly
488         ia64            Intel Itanium 64
489         masm            Microsoft assembly (probably works for any 80x86)
490         nasm            Netwide assembly
491         tasm            Turbo Assembly (with opcodes 80x86 up to Pentium, and
492                         MMX)
493         pic             PIC assembly (currently for PIC16F84)
495 The most flexible is to add a line in your assembly file containing:
496 >       asmsyntax=nasm
497 Replace "nasm" with the name of the real assembly syntax.  This line must be
498 one of the first five lines in the file.
500 The syntax type can always be overruled for a specific buffer by setting the
501 b:asmsyntax variable:
502 >       let b:asmsyntax=nasm
504 If b:asmsyntax is not set, either automatically or by hand, then the value of
505 the global variable asmsyntax is used.  This can be seen as a default assembly
506 language:
507 >       let asmsyntax=nasm
509 As a last resort, if nothing is defined, the "asm" syntax is used.
512 Netwide assembler (nasm.vim) optional highlighting ~
514 To enable a feature:
515 >       let   {variable}=1|set syntax=nasm
516 To disable a feature:
517 >       unlet {variable}  |set syntax=nasm
519 Variable                Highlight ~
520 nasm_loose_syntax       unofficial parser allowed syntax not as Error
521                           (parser dependend; not recommended)
522 nasm_ctx_outside_macro  contexts outside macro not as Error
523 nasm_no_warn            potentially risky syntax not as ToDo
526                                                         *basic.vim* *vb.vim*
527 Both Visual Basic and "normal" basic use the extension ".bas".  To detect
528 which one should be used, Vim checks for the string "VB_Name" in the first
529 five lines of the file.  If it is not found, filetype will be "basic",
530 otherwise "vb".  Files with the ".frm" extension will always be seen as Visual
531 Basic.
534 C                                                       *c.vim*
536 A few things in C highlighting are optional.  To enable them assign any value
537 to the respective value.  Example:
538 >  let c_comment_strings=1
539 To disable them use ":unlet".  Example:
540 >  unlet c_comment_strings
542 variable                Highlight ~
543 c_comment_strings       strings and numbers inside a comment
544 c_space_errors          trailing white space and spaces before a <Tab>
545 c_no_trail_space_error   ... but no trailing spaces
546 c_no_tab_space_error     ... but no spaces before a <Tab>
547 c_no_ansi               don't do standard ANSI types and constants
548 c_ansi_typedefs          ... but do standard ANSI types
549 c_ansi_constants         ... but do standard ANSI constants
550 c_no_utf                don't highlight \u and \U in strings
551 c_syntax_for_h          use C syntax for *.h files, instead of C++
552 c_no_if0                don't highlight "#if 0" blocks as comments
553 c_no_cformat            don't highlight %-formats in strings
555 If you notice highlighting errors while scrolling backwards, which are fixed
556 when redrawing with CTRL-L, try setting the "c_minlines" internal variable
557 to a larger number:
558 >  let c_minlines = 100
559 This will make the syntax synchronization start 100 lines before the first
560 displayed line.  The default value is 50 (15 when c_no_if0 is set).  The
561 disadvantage of using a larger number is that redrawing can become slow.
563 When using the "#if 0" / "#endif" comment highlighting, notice that this only
564 works when the "#if 0" is within "c_minlines" from the top of the window.  If
565 you have a long "#if 0" construct it will not be highlighted correctly.
567 To match extra items in comments the cCommentGroup cluster can be used.
568 Example:
569 >   au Syntax c call MyCadd()
570 >   function MyCadd()
571 >     syn keyword cMyItem contained Ni
572 >     syn cluster cCommentGroup add=cMyItem
573 >     hi link cMyItem Title
574 >   endfun
576 ANSI constants will be highlighted with the "cConstant" group.  This includes
577 "NULL", "SIG_IGN" and others.  But not "TRUE", for example, because this is
578 not in the ANSI standard.  If you find this confusing, remove the cConstant
579 highlighting:
580 >   :hi link cConstant NONE
583 COBOL                                                   *cobol.vim*
585 COBOL highlighting for legacy code has different needs than fresh development.
586 This is due both to differences in what is being done (maintenance versus
587 development) as well as other factors.  To enable legacy code highlighting,
588 add this line to you .vimrc:
589 >  let cobol_legacy_code=1
590 To disable it again, use this:
591 >  unlet cobol_legacy_code
594 CYNLIB                                                  *cynlib.vim*
596 Cynlib files are C++ files that use the Cynlib class library to enable
597 hardware modelling and simulation using C++. Typically Cynlib files have a .cc
598 or a .cpp extension, which makes it very difficult to distinguish them from a
599 normal C++ file. Thus, to enable Cynlib highlighting for .cc files, add this
600 line to your .vimrc file:
602 >  let cynlib_cyntax_for_cc=1
604 Similarly for cpp files (this extension is only usually used in Windows)
606 >  let cynlib_cyntax_for_cpp=1
608 To disable these again, use this:
610 >  unlet cynlib_cyntax_for_cc
611 >  unlet cynlib_cyntax_for_cpp
614 CWEB                                                    *cweb.vim*
616 Files matching "*.w" could be Progress or cweb.  If the automatic detection
617 doesn't work for you, or you don't edit Progress at all, use this in your
618 startup vimrc:
619 >   :let filetype_w = "cweb"
622 DTD                                                     *dtd.vim*
624 The DTD syntax highlighting is case sensitive by default. To disable
625 case-sensitive highlighting, add the following line to your startup file:
627 >  let dtd_ignore_case=1
629 The DTD syntax file will highlight unknown tags as errors. If
630 this is annoying, it can be turned off by setting:
632 >  let dtd_no_tag_errors=1
634 before sourcing the dtd.vim syntax file.
635 Parameter entity names are highlighted in the definition using the
636 'Type' highlighting group and 'Comment' for punctuation and '%'.
637 Parameter entity instances are highlighted using the 'Constant'
638 highlighting group and the 'Type' highlighting group for the
639 delimiters % and ;. This can be turned off by setting:
641 >  let dtd_no_param_entities=1
643 The DTD syntax file is also included by xml.vim to highlight included dtd's.
646 EIFFEL                                                  *eiffel.vim*
648 While Eiffel is not case-sensitive, its style guidelines are, and the
649 syntax highlighting file encourages their use. This also allows to
650 highlight class names differently. If you want to disable case-sensitive
651 highlighting, add the following line to your startup file:
653 >  let eiffel_ignore_case=1
655 Case still matters for class names and TODO marks in comments.
657 Conversely, for even stricter checks, add one of the following lines:
659 >  let eiffel_strict=1
660 >  let eiffel_pedantic=1
662 Setting eiffel_strict will only catch improper capitalization for the
663 five predefined words "Current", "Void", "Result", "Precursor", and
664 "NONE", to warn against their accidental use as feature or class names.
666 Setting eiffel_pedantic will enforce adherence to the Eiffel style
667 guidelines fairly rigorously (like arbitrary mixes of upper- and
668 lowercase letters as well as outdated ways to capitalize keywords).
670 If you want to use the lower-case version of "Current", "Void",
671 "Result", and "Precursor", you can use
673 >  let eiffel_lower_case_predef=1
675 instead of completely turning case-sensitive highlighting off.
677 Support for ISE's proposed new creation syntax that is already
678 experimentally handled by some compilers can be enabled by:
680 >  let eiffel_ise=1
682 Finally, some vendors support hexadecimal constants. To handle them, add
684 >  let eiffel_hex_constants=1
686 to your startup file.
689 ERLANG                                                  *erlang.vim*
691 The erlang highlighting supports Erlang (ERicsson LANGuage).
692 Erlang is case sensitive and default extension is ".erl".
694 You can disable some highlighting groups if you put the following commands in
695 your .vimrc file:
697 This command will disable comments, operators, strings and numbers:
698 >       let erlang_characters=1
700 And for disabling keywords and functions you may use:
701 >       let erlang_functions=1
702 >       let erlang_keywords=1
705 FORM                                                 *form.vim*
707 The coloring scheme for syntax elements in the FORM file uses the default
708 modes Conditional, Number, Statement, Comment, PreProc, Type, and String,
709 following the language specifications in 'Symbolic Manipulation with FORM'' by
710 J.A.M. Vermaseren, CAN, Netherlands, 1991.
712 If you want include your own changes to the default colors, you have to
713 redefine the following syntax groups:
715     - formConditional
716     - formNumber
717     - formStatement
718     - formHeaderStatement
719     - formComment
720     - formPreProc
721     - formDirective
722     - formType
723     - formString
725 Note that the form.vim syntax file implements FORM preprocessor commands and
726 directives per default in the same syntax group.
728 A predefined enhanced color mode for FORM is available to distinguish between
729 header statements and statements in the body of a FORM program. To activate
730 this mode define the following variable in your vimrc file
732 >   let form_enhanced_color=1
734 The enhanced mode also takes advantage of additional color features for a dark
735 gvim display. Here, statements are colored LightYellow instead of Yellow, and
736 conditionals are LightBlue for better distinction.
739 FORTRAN                                                 *fortran.vim*
741 Default highlighting and dialect ~
742 Highlighting appropriate for f95 (Fortran 95) is used by default. This choice
743 should be appropriate for most users most of the time because Fortran 95 is a
744 superset of Fortran 90 and almost a superset of Fortran 77.
746 Fortran source code form ~
747 Fortran 9x code can be in either fixed or free source form. Note that the
748 syntax highlighting will not be correct if the form is incorrectly set.
750 When you create a new fortran file, the syntax script assumes fixed source
751 form. If you always use free source form, then
752 >   :let fortran_free_source=1
753 in your .vimrc prior to the :syntax on command.
754 If the form of the source code depends upon the file extension, then it is
755 most convenient to set fortran_free_source with an autocommand.
757 When you edit an existing fortran file, the syntax script will assume free
758 source form if the fortran_free_source variable has been set. If it has not
759 been set, the syntax script attempts to determine which source form has been
760 used by examining the first five columns of the first 25 lines of your file.
761 If no signs of free source form are detected, then the file is assumed to be
762 in fixed source form. The algorithm should work in the vast majority of cases.
763 In some cases, such as a file that begins with 25 or more full-line comments,
764 the script may incorrectly decide that the fortran code is in fixed form. If
765 that happens, just add a non-comment statement beginning anywhere in the first
766 five columns of the first twenty five lines, save (:w) and then reload (:e!)
767 the file.
769 Tabs in fortran files ~
770 Tabs are not recognized by the Fortran standards. Tabs are not a good idea in
771 fixed format fortran source code which requires fixed column boundaries.
772 Therefore, tabs are marked as errors. Nevertheless, some programmers like
773 using tabs. If your fortran files contain tabs, then you should set the
774 variable fortran_have_tabs in your .vimrc with a command such as
775 >    :let fortran_have_tabs=1
776 placed prior to the :syntax on command. Unfortunately, the use of tabs will
777 mean that the syntax file will not be able to detect incorrect margins.
779 Non-default fortran dialects ~
780 The syntax script supports five Fortran dialects: f95, f90, f77, the Lahey
781 subset elf90, and the Imagine1 subset F.
783 If you use f77 with extensions, even common ones like do/enddo loops, do/while
784 loops and free source form that are supported by most f77 compilers including
785 g77 (GNU Fortran), then you will probably find the default highlighting
786 satisfactory. However, if you use strict f77 with no extensions, not even free
787 source form or the MIL STD 1753 extensions, then the advantages of setting the
788 dialect to f77 are that names such as SUM are recognized as user variable
789 names and not highlighted as f9x intrinsic functions, that obsolete constructs
790 such as ASSIGN statements are not highlighted as todo items, and that fixed
791 source form will be assumed.
793 If you use elf90 or F, the advantage of setting the dialect appropriately is
794 that f90 features excluded from these dialects will be highlighted as todo
795 items and that free source form will be assumed as required for these
796 dialects.
798 The dialect can be selected by setting the variable fortran_dialect. The
799 permissible values of fortran_dialect are case-sensitive and must be "f95",
800 "f90", "f77", "elf" or "F". Invalid values of fortran_dialect are ignored.
802 If all your fortran files use the same dialect, set fortran_dialect in your
803 .vimrc prior to your syntax on statement. If the dialect depends upon the file
804 extension, then it is most convenient to use autocommands.
806 Finer control is necessary if the file extension does not uniquely identify
807 the dialect. You can override the default dialect, on a file-by-file basis, by
808 including a comment with the directive "fortran_dialect=xx" (where xx=f77 or
809 elf or F or f90 or f95) in one of the first three lines in your file. For
810 example, your older .f files may be written in extended f77 but your newer
811 ones may be F codes, and you would identify the latter by including in the
812 first three lines of those files a Fortran comment of the form
813 >  ! fortran_dialect=F
814 F overrides elf if both directives are present.
816 Limitations ~
817 Parenthesis checking does not catch too few closing parentheses. Hollerith
818 strings are not recognized. Some keywords may be highlighted incorrectly
819 because Fortran90 has no reserved words.
822 FVWM CONFIGURATION FILES                                *fvwm.vim*
824 In order for Vim to recognize Fvwm configuration files that do not match
825 the patterns *fvwmrc* or *fvwm2rc*, you must put additional patterns
826 appropriate to your system in your myfiletypes.vim file.  For these
827 patterns, you must set the variable "b:fvwm_version" to the major version
828 number of Fvwm, and the 'filetype' option to fvwm.
830 For example, to make Vim identify all files in /etc/X11/fvwm2/
831 as Fvwm2 configuration files, add the following:
833 >  au! BufNewFile,BufRead /etc/X11/fvwm2/*  let b:fvwm_version = 2 |
834 >                                         \ set filetype=fvwm
836 If you'd like Vim to highlight all valid color names, tell it where to
837 find the color database (rgb.txt) on your system.  Do this by setting
838 "rgb_file" to its location.  Assuming your color database is located
839 in /usr/X11/lib/X11/, you should add the line
841 >  let rgb_file = "/usr/X11/lib/X11/rgb.txt"
843 to your .vimrc file.
846 GSP                                                     *gsp.vim*
848 The default coloring style for GSP pages is defined by |html.vim|, and
849 the coloring for java code (within java tags or inline between backticks)
850 is defined by |java.vim|.  The following HTML groups defined in |html.vim|
851 are redefined to incorporate and highlight inline java code:
853     htmlString
854     htmlValue
855     htmlEndTag
856     htmlTag
857     htmlTagN
859 Highlighting should look fine most of the places where you'd see inline
860 java code, but in some special cases it may not.  To add another HTML
861 group where you will have inline java code where it does not highlight
862 correctly, just copy the line you want from |html.vim| and add gspJava
863 to the contains clause.
865 The backticks for inline java are highlighted according to the htmlError
866 group to make them easier to see.
869 HTML                                                    *html.vim*
871 The coloring scheme for tags in the HTML file works as follows.
873 The  <> of opening tags are colored differently than the </> of a closing tag.
874 This is on purpose! For opening tags the 'Function' color is used, while for
875 closing tags the 'Type' color is used (See syntax.vim to check how those are
876 defined for you)
878 Known tag names are colored the same way as statements in C.  Unknown tag
879 names are colored with the same color as the <> or </> respectively which
880 makes it easy to spot errors
882 Note that the same is true for argument (or attribute) names. Known attribute
883 names are colored differently than unknown ones.
885 Some HTML tags are used to change the rendering of text. The following tags
886 are recognized by the html.vim syntax coloring file and change the way normal
887 text is shown: <B> <I> <U> <EM> <STRONG> (<EM> is used as an alias for <I>,
888 while <STRONG> as an alias for <B>), <H1> - <H6>, <HEAD>, <TITLE> and <A>, but
889 only if used as a link that is, it must include a href as in
890 <A href="somfile.html">).
892 If you want to change how such text is rendered, you must redefine the
893 following syntax groups:
895     - htmlBold
896     - htmlBoldUnderline
897     - htmlBoldUnderlineItalic
898     - htmlUnderline
899     - htmlUnderlineItalic
900     - htmlItalic
901     - htmlLink for links
902     - htmlTitle for titles
903     - htmlH1 - htmlH6 for headings
905 To make this redefinition work you must redefine them all with the exception
906 of the last two (htmlTitle and htmlH[1-6], which are optional) and define the
907 following variable in your vimrc (this is due to the order in which the files
908 are read during initialization)
909 >   let html_my_rendering=1
911 If you'd like to see an example download mysyntax.vim at
912 http://www.fleiner.com/vim/mysyntax.vim
914 You can also disable this rendering by adding the following line to your
915 vimrc file:
916 >   let html_no_rendering=1
918 HTML comments are rather special (see an HTML reference document for the
919 details), and the syntax coloring scheme will highlight all errors.
920 However, if you prefer to use the wrong style (starts with <!-- and
921 ends with --!>) you can define
922 >   let html_wrong_comments=1
924 JavaScript and Visual Basic embedded inside HTML documents are highlighted as
925 'Special' with statements, comments, strings and so on colored as in standard
926 programming languages. Note that only JavaScript and Visual Basic are currently
927 supported, no other scripting language has been added yet.
929 Embedded and inlined cascading style sheets (CSS) are highlighted too.
931 There are several html preprocessor languages out there. html.vim has been
932 written such that it should be trivial to include it. To do so add the
933 following two lines to the syntax coloring file for that language
934 (the example comes from the asp.vim file):
936     source <sfile>:p:h/html.vim
937     syn cluster htmlPreproc add=asp
939 Now you just need to make sure that you add all regions that contain
940 the preprocessor language to the cluster htmlPreproc.
943 HTML/OS (by Aestiva)                                    *htmlos.vim*
945 The coloring scheme for HTML/OS works as follows:
947 Functions and variable names are the same color by default, because VIM
948 doesn't specify different colors for Functions and Identifiers.  To change
949 this (which is recommended if you want function names to be recognizable in a
950 different color) you need to add the following line to either your ~/.vimrc:
951 > :hi Function term=underline cterm=bold ctermfg=LightGray
953 Of course, the ctermfg can be a different color if you choose.
955 Another issues that HTML/OS runs into is that there is no special filetype to
956 signify that it is a file with HTML/OS coding.  You can change this by opening
957 a file and turning on HTML/OS syntax by doing the following:
958 > :set syntax=htmlos
960 Lastly, it should be noted that the opening and closing characters to begin a
961 block of HTML/OS code can either be << or [[ and >> or ]], respectively.
964 IA64                                                *ia64.vim* *intel-itanium*
966 Highlighting for the Intel Itanium 64 assembly language.  See |asm.vim| for
967 how to recognize this filetype.
969 To have *.inc files be recognized as IA64, add this to your .vimrc file:
970 >       :let g:filetype_inc = "ia64"
973 INFORM                                                  *inform.vim*
975 Inform highlighting includes symbols provided by the Inform Library, as
976 most programs make extensive use of it.  If do not wish Library symbols
977 to be highlighted add this to your vim startup:
978 >   let inform_highlight_simple=1
980 By default it is assumed that Inform programs are Z-machine targetted,
981 and highlights Z-machine assembly language symbols appropriately.  If
982 you intend your program to be targetted to a Glulx/Glk environment you
983 need to add this to your startup sequence:
984 >   let inform_highlight_glulx=1
986 This will highlight Glulx opcodes instead, and also adds glk() to the
987 set of highlighted system functions.
990 JAVA                                                    *java.vim*
992 The java.vim syntax highlighting file offers several options:
994 In Java 1.0.2 it was never possible to have braces inside parens, so this was
995 flagged as an error.  Since Java 1.1 this is possible (with anonymous
996 classes), and therefore is no longer marked as an error. If you prefer the old
997 way, put the following line into your vim startup file:
998 >  let java_mark_braces_in_parens_as_errors=1
1000 All identifiers in java.lang.* are always visible in all classes.  To
1001 highlight them use:
1002 >  let java_highlight_java_lang_ids=1
1004 You can also highlight identifiers of most standard java packages
1005 if you download the script at http://www.fleiner.com/vim/syntax/javaid.vim
1006 If you prefer to only highlight identifiers of a certain package, say
1007 java.io use the following:
1008 >  let java_highligh_java_io=1
1009 Check the javaid.vim file for a list of all the packages that are supported.
1011 Function names are not highlighted, as the way to find functions depends on
1012 how you write java code.  The syntax file knows two possible ways to highlight
1013 functions:
1015 If you write function declarations that are always indented by either
1016 a tab, 8 spaces or 2 spaces you may want to set
1017 >  let java_highlight_functions="indent"
1018 However, if you follow the java guidlines about how functions and classes are
1019 supposed to be named (with respect to upper and lower cases), use
1020 >  let java_highlight_functions="style"
1021 If both options do not work for you, but you would still want function
1022 declarations to be highlighted create your own definitions by changing the
1023 definitions in java.vim or by creating your own java.vim which includes the
1024 original one and then adds the code to highlight functions.
1026 In java 1.1 the functions System.out.println() and System.err.println() should
1027 only be used for debugging. Therefor it is possible to highlight debugging
1028 statements differently. To do this you must add the following definition in
1029 your startup file:
1030 >  let java_highlight_debug=1
1031 The result will be that those statements are highlighted as 'Special'
1032 characters. If you prefer to have them highlighted differently you must define
1033 new highlightings for the following groups.:
1034     Debug, DebugSpecial, DebugString, DebugBoolean, DebugType
1035 which are used for the statement itself, special characters used in debug
1036 strings, strings, boolean constants and types (this, super) respectively. I
1037 have opted to chose another background for those statements.
1039 In order to help you to write code that can be easely ported between
1040 java and C++, all C++ keywords are marked as error in a java program.
1041 However, if you use them regularly, you may want to define the following
1042 variable in your .vimrc file:
1043 >  let java_allow_cpp_keywords=1
1045 Javadoc is a program that takes special comments out of java program files and
1046 creates HTML pages. The standard configuration will highlight this HTML code
1047 similarly to HTML files (see |html.vim|). You can even add javascript
1048 and CSS inside this code (see below). There are four differences however:
1049   1. The title (all characters up to the first '.' which is followed by
1050      some white space or up to the first '@') is colored differently (to change
1051      the color change the group CommentTitle).
1052   2. The text is colored as 'Comment'.
1053   3. HTML comments are colored as 'Special'
1054   4. The special javadoc tags (@see, @param, ...) are highlighted as specials
1055      and the argument (for @see, @param, @exception) as Function.
1056 To turn this feature off add the following line to your startup file:
1057 >  let java_ignore_javadoc=1
1059 If you use the special javadoc comment highlighting described above you
1060 can also turn on special highlighting for javascript, visual basic
1061 scripts and embedded CSS (stylesheets). This makes only sense if you
1062 actually have javadoc comments that include either javascript or embedded
1063 CSS. The options to use are
1064 >  let java_javascript=1
1065 >  let java_css=1
1066 >  let java_vb=1
1068 If you notice highlighting errors while scrolling backwards, which are fixed
1069 when redrawing with CTRL-L, try setting the "java_minlines" internal variable
1070 to a larger number:
1071 >  let java_minlines = 50
1072 This will make the syntax synchronization start 50 lines before the first
1073 displayed line.  The default value is 10.  The disadvantage of using a larger
1074 number is that redrawing can become slow.
1077 LACE                                                    *lace.vim*
1079 Lace (Language for Assembly of Classes in Eiffel) is case insensitive, but the
1080 style guide lines are not.  If you prefer case insensitive highlighting, just
1081 define the vim variable 'lace_case_insensitive' in your startup file:
1082 >  let lace_case_insensitive=1
1085 LEX                                                     *lex.vim*
1087 Lex uses brute-force synchronizing as the "^%%$" section delimiter
1088 gives no clue as to what section follows.  Consequently, the value for
1089 >syn sync minlines=300
1090 may be changed by the user if s/he is experiencing synchronization
1091 difficulties (such as may happen with large lex files).
1094 LITE                                                    *lite.vim*
1096 There are two options for the lite syntax highlighting.
1098 If you like SQL syntax highligthing inside Strings, use this:
1100 >  let lite_sql_query = 1
1102 For syncing, minlines defaults to 100.  If you prefer another value, you can
1103 set "lite_minlines" to the value you desire.  Example:
1105 >  let lite_minlines = 200
1108 MAPLE                                                   *maple.vim*
1110 Maple V, by Waterloo Maple Inc, supports symbolic algebra.  The language
1111 supports many packages of functions which are selectively loaded by the user.
1112 The standard set of packages' functions as supplied in Maple V release 4 may be
1113 highlighted at the user's discretion.  Users may place in their .vimrc file:
1115 >  let mvpkg_all= 1
1117 to get all package functions highlighted, or users may select any subset by
1118 choosing a variable/package from the table below and setting that variable to
1119 1, also in their .vimrc file (prior to sourcing
1120 $VIMRUNTIME/syntax/syntax.vim).
1122         Table of Maple V Package Function Selectors ~
1123 >  mv_DEtools    mv_genfunc     mv_networks     mv_process
1124 >  mv_Galois     mv_geometry    mv_numapprox    mv_simplex
1125 >  mv_GaussInt   mv_grobner     mv_numtheory    mv_stats
1126 >  mv_LREtools   mv_group       mv_orthopoly    mv_student
1127 >  mv_combinat   mv_inttrans    mv_padic        mv_sumtools
1128 >  mv_combstruct mv_liesymm     mv_plots        mv_tensor
1129 >  mv_difforms   mv_linalg      mv_plottools    mv_totorder
1130 >  mv_finance    mv_logic       mv_powseries
1133 MSQL                                                    *msql.vim*
1135 There are two options for the msql syntax highlighting.
1137 If you like SQL syntax highligthing inside Strings, use this:
1139 >  let msql_sql_query = 1
1141 For syncing, minlines defaults to 100.  If you prefer another value, you can
1142 set "msql_minlines" to the value you desire.  Example:
1144 >  let msql_minlines = 200
1147 NCF                                                     *ncf.vim*
1149 There is one option for NCF syntax highlighting.
1151 If you want to have unrecognized (by ncf.vim) statements highlighted as
1152 errors, use this:
1154 >  let ncf_highlight_unknowns = 1
1156 If you don't want to highlight these errors, leave it unset.
1159 NROFF                                                   *nroff.vim*
1161 To mark trailing spaces as an error, use this:
1163 >  let nroff_space_errors = 1
1166 PASCAL                                                  *pascal.vim*
1168 Files matching "*.p" could be Progress or Pascal.  If the automatic detection
1169 doesn't work for you, or you don't edit Progress at all, use this in your
1170 startup vimrc:
1172 >   :let filetype_p = "pascal"  
1174 The Pascal syntax file has been extended to take into account some extensions
1175 provided by Turbo Pascal, Free Pascal Compiler and GNU Pascal Compiler.
1176 Delphi keywords are also supported. By default, Turbo Pascal 7.0 features are
1177 enabled.  If you prefer to stick with the standard Pascal keywords, add the
1178 following line to your startup file:
1180 >   :let pascal_traditional=1
1182 To switch on Delphi specific constructions (such as one-line comments,
1183 keywords, etc):
1185 >   :let pascal_delphi=1
1188 The option pascal_symbol_operator controls whether symbol operators such as +,
1189 *, .., etc. are displayed using the Operator color or not.  To colorize symbol
1190 operators, add the following line to your startup file:
1192 >   :let pascal_symbol_operator=1
1194 Some functions are highlighted by default.  To switch it off:
1196 >   :let pascal_no_functions=1
1198 Furthermore, there are specific variable for some compiler.  Besides
1199 pascal_delphi, there are pascal_gpc and pascal_fpc.  Default extensions try to
1200 match Turbo Pascal.
1202 >   :let pascal_gpc=1
1206 >   :let pascal_fpc=1
1208 To ensure that strings are defined on a single line, you can define the
1209 pascal_one_line_string variable.
1211 >   :let pascal_one_line_string=1
1213 If you dislike <Tab> chars, you can set the pascal_no_tabs variable.  Tabs
1214 will be highlighted as Error.
1216 >   :let pascal_no_tabs=1
1219 PERL                                                    *perl.vim*
1221 There are a number of possible options to the perl syntax highlighting.
1223 If you use POD files or POD segments, you might:
1225 > let perl_include_POD = 1
1227 To handle package references in variable and function names differently from
1228 the rest of the name (like 'PkgName::' in '$PkgName::VarName'):
1230 > let perl_want_scope_in_variables = 1
1232 If you want complex things like '@{${"foo"}}' to be parsed:
1234 > let perl_extended_vars = 1
1236 The coloring strings can be changed. By default strings and qq friends will be
1237 highlighted like the first line. If you set the variable
1238 perl_string_as_statement, it will be highlighted as in the second line.
1240    "hello world!"; qq|hello world|;
1241    ^^^^^^^^^^^^^^NN^^^^^^^^^^^^^^^N       (unlet perl_string_as_statement)
1242    S^^^^^^^^^^^^SNNSSS^^^^^^^^^^^^N       (let perl_string_as_statement)
1244 (^ = perlString, S = perlStatement, N = None at all)
1246 The syncing has 3 options. The first two switch off some triggering of
1247 synchronization and should only be needed in case it fails to work properly.
1248 If while scrolling all of a sudden the whole screen changes color completely
1249 then you should try and switch off one of those. Let me know if you can figure
1250 out the line that causes the mistake.
1252 One triggers on "^\s*sub\s*" and the other on "^[$@%]" more or less.
1254 > let perl_no_sync_on_sub
1255 > let perl_no_sync_on_global_var
1257 Below you can set the maximum distance VIM should look for starting points for
1258 its attempts in syntax highlighting.
1260 > let perl_sync_dist = 100
1262 For the "<<xxx" construct (here Documents), Vim can't check for any value of
1263 "xxx".  If you have a choice use "<<EOF ... EOF", then the highlighting will
1264 work.
1267 PHP3 and PHP4                                   *php.vim* *php3.vim*
1269 [note: previously this was called "php3", but since it now also supports php4
1270 it has been renamed to "php"]
1272 There are the following options to the php syntax highlighting.
1274 If you like SQL syntax hightligthing inside Strings:
1276 >  let php_sql_query = 1
1278 For highligthing the Baselib methods:
1280 >  let php_baselib = 1
1282 Enable HTML syntax highligthing inside strings:
1284 >  let php_htmlInStrings = 1
1286 For syncing minlines is being set default to 100. If you
1287 prefer another value, please make use of something like:
1289 >  let php_minlines = 200
1291 Using the old colorstyle:
1293 >  let php_oldStyle = 1
1295 Enable parent error highlighting:
1297 >  let_parentError = 1
1299 Enable highlighting ASP-style short tags:
1301 >  let php_asp_tags = 1
1303 Disable short tags:
1305 >  let php_noShortTags = 1
1308 PPWIZARD (preprocessor for HTML and OS/2 INF files)             *ppwiz.vim* 
1310 This syntax file has the options:
1312 - ppwiz_highlight_defs : determines highlighting mode for PPWizard's
1313   definitions. Possible values are
1315   ppwiz_highlight_defs = 1 : PPWizard #define statements retain the
1316     colors of their contents (e. g. PPWizard macros and variables)
1318   ppwiz_highlight_defs = 2 : preprocessor #define and #evaluate
1319     statements are shown in a single color with the exception of line
1320     continuation symbols
1322   The default setting for ppwiz_highlight_defs is 1.
1324 - ppwiz_with_html : If the value is 1 (the default), highlight literal
1325   HTML code; if 0, treat HTML code like ordinary text.
1328 PHTML                                                   *phtml.vim*
1330 There are two options for the phtml syntax highlighting.
1332 If you like SQL syntax highligthing inside Strings, use this:
1334 >  let phtml_sql_query = 1
1336 For syncing, minlines defaults to 100.  If you prefer another value, you can
1337 set "phtml_minlines" to the value you desire.  Example:
1339 >  let phtml_minlines = 200
1342 POSTSCRIPT                                              *postscr.vim*
1344 There are several options when it comes to highlighting PostScript.
1346 First which version of the PostScript language to highlight.  There are
1347 currently three defined language versions, or levels.  Level 1 is the original
1348 and base version, and includes all extensions prior to the release of level 2.
1349 Level 2 is the most common version around, and includes its own set of
1350 extensions prior to the release of level 3.  Level 3 is currently the highest
1351 level supported.  You select which level of the PostScript language you want
1352 highlighted by defining the postscr_level variable as follows:
1354 >  let postscr_level=2
1356 If this variable is not defined it defaults to 2 (level 2) since this is
1357 the most prevalent version currently.
1359 Note, not all PS interpreters will support all language features for a
1360 particular language level.  In particular the %!PS-Adobe-3.0 at the start of
1361 PS files does NOT mean the PostScript present is level 3 PostScript!
1363 If you are working with Display PostScript, you can include highlighting of
1364 Display PS language features by defining the postscr_display variable as
1365 follows:
1367 >  let postscr_display=1
1369 If you are working with Ghostscript, you can include highlighting of
1370 Ghostscript specific language features by defining the variable
1371 postscr_ghostscript as follows:
1373 >  let postscr_ghostscript=1
1375 PostScript is a large language, with many predefined elements.  While it
1376 useful to have all these elements highlighted, on slower machines this can
1377 cause Vim to slow down.  In an attempt to be machine friendly font names and
1378 character encodings are not highlighted by default.  Unless you are working
1379 explicitly with either of these this should be ok.  If you want them to be
1380 highlighted you should set one or both of the following variables:
1382 >  let postscr_fonts=1
1383 >  let postscr_encodings=1
1385 There is a stylistic option to the highlighting of and, or, and not.  In
1386 PostScript the function of these operators depends on the types of their
1387 operands - if the operands are booleans then they are the logical operators,
1388 if they are integers then they are binary operators.  As binary and logical
1389 operators can be highlighted differently they have to be highlighted one way
1390 or the other.  By default they are treated as logical operators.  They can be
1391 highlighted as binary operators by defining the variable
1392 postscr_andornot_binary as follows:
1394 >  let postscr_andornot_binary=1
1397 PRINTCAP + TERMCAP              *ptcap.vim* *termcap-syntax* *printcap-syntax*
1399 This syntax file applies to the printcap and termcap databases.
1401 In order for Vim to recognize printcap/termcap files that do not match
1402 the patterns *printcap*, or *termcap*, you must put additional patterns
1403 appropriate to your system in your |myfiletypefile| file.  For these
1404 patterns, you must set the variable "b:ptcap_type" to either "print" or
1405 "term", and then the 'filetype' option to ptcap.
1407 For example, to make Vim identify all files in /etc/termcaps/ as termcap
1408 files, add the following:
1410 >  au BufNewFile,BufRead /etc/termcaps/* let b:ptcap_type = "term" |
1411 >                                       \ set filetype=ptcap
1413 If you notice highlighting errors while scrolling backwards, which
1414 are fixed when redrawing with CTRL-L, try setting the "ptcap_minlines"
1415 internal variable to a larger number:
1417   let ptcap_minlines = 50
1419 (The default is 20 lines.)
1422 PROGRESS                                        *progress.vim*
1424 Files matching "*.w" could be Progress or cweb.  If the automatic detection
1425 doesn't work for you, or you don't edit cweb at all, use this in your
1426 startup vimrc:
1427 >   :let filetype_w = "progress"
1428 The same happens for "*.i", which could be assembly, and "*.p", which could be
1429 Pascal.  Use this if you don't use assembly and Pascal:
1430 >   :let filetype_i = "progress"
1431 >   :let filetype_p = "progress"
1434 PYTHON                                                  *python.vim*
1436 There are four options to control Python syntax highlighting.
1438 For highlighted numbers:
1439 >  let python_highlight_numbers = 1
1441 For highlighted builtin functions:
1442 >  let python_highlight_builtins = 1
1444 For highlighted standard exceptions:
1445 >  let python_highlight_exceptions = 1
1447 If you want all possible Python highlighting (the same as setting the
1448 preceding three options):
1449 >  let python_highlight_all = 1
1452 REXX                                                    *rexx.vim*
1454 If you notice highlighting errors while scrolling backwards, which are fixed
1455 when redrawing with CTRL-L, try setting the "rexx_minlines" internal variable
1456 to a larger number:
1457 >  let rexx_minlines = 50
1458 This will make the syntax synchronization start 50 lines before the first
1459 displayed line.  The default value is 10.  The disadvantage of using a larger
1460 number is that redrawing can become slow.
1463 RUBY                                                    *ruby.vim*
1465 There are a few options to the Ruby syntax highlighting.
1467 By default, the "end" keyword is colorized according to the opening statement
1468 of the block it closes. While useful, this feature can be expensive: if you
1469 experience slow redrawing (or you are on a terminal with poor color support)
1470 you may want to turn it off by defining the "ruby_no_expensive" variable:
1471 >   let ruby_no_expensive = 1
1472 In this case the same color will be used for all control keywords.
1474 If you do want this feature enabled, but notice highlighting errors while
1475 scrolling backwards, which are fixed when redrawing with CTRL-L, try setting
1476 the "ruby_minlines" variable to a value larger than 50:
1477 >   let ruby_minlines = 100
1478 Ideally, this value should be a number of lines large enough to embrace your
1479 largest class or module.
1481 Finally, if you do not like to see too many color items around, you can define
1482 "ruby_no_identifiers":
1483 >   let ruby_no_identifiers = 1
1484 This will prevent highlighting of special identifiers like "ConstantName",
1485 "$global_var", "@instace_var", "| iterator |", and ":symbol".
1488 SED                                                     *sed.vim*
1490 To make tabs stand out from regular blanks (accomplished by using Todo
1491 highlighting on the tabs), define "highlight_sedtabs" by putting
1493 >  let highlight_sedtabs = 1
1495 in the vimrc file.  (This special highlighting only applies for tabs
1496 inside search patterns, replacement texts, addresses or text included
1497 by an Append/Change/Insert command.)  If you enable this option, it is
1498 also a good idea to set the tab width to one character; by doing that,
1499 you can easily count the number of tabs in a string.
1501 Bugs:
1503   The transform command (y) is treated exactly like the substitute
1504   command.  This means that, as far as this syntax file is concerned,
1505   transform accepts the same flags as substitute, which is wrong.
1506   (Transform accepts no flags.)  I tolerate this bug because the
1507   involved commands need very complex treatment (95 patterns, one for
1508   each plausible pattern delimiter).
1511 SGML                                                    *sgml.vim*
1513 The coloring scheme for tags in the SGML file works as follows.
1515 The <> of opening tags are colored differently than the </> of a closing tag.
1516 This is on purpose! For opening tags the 'Function' color is used, while for
1517 closing tags the 'Type' color is used (See syntax.vim to check how those are
1518 defined for you)
1520 Known tag names are colored the same way as statements in C.  Unknown tag
1521 names are not colored which makes it easy to spot errors.
1523 Note that the same is true for argument (or attribute) names. Known attribute
1524 names are colored differently than unknown ones.
1526 Some SGML tags are used to change the rendering of text. The following tags
1527 are recognized by the sgml.vim syntax coloring file and change the way normal
1528 text is shown: <varname> <emphasis> <command> <function> <literal>
1529 <replaceable> <ulink> and <link>.
1531 If you want to change how such text is rendered, you must redefine the
1532 following syntax groups:
1534     - sgmlBold
1535     - sgmlBoldItalic
1536     - sgmlUnderline
1537     - sgmlItalic
1538     - sgmlLink for links
1540 To make this redefinition work you must redefine them all and define the
1541 following variable in your vimrc (this is due to the order in which the files
1542 are read during initialization)
1543 >   let sgml_my_rendering=1
1545 You can also disable this rendering by adding the following line to your
1546 vimrc file:
1547 >   let sgml_no_rendering=1
1549 (Adapted from the html.vim help text by Claudio Fleiner <claudio@fleiner.com>)
1552 SH                                                      *sh.vim*
1554 This covers the "normal" Unix sh, bash and the korn shell.  If you're working
1555 on a system where bash is called sh, you will benefit to define the vim
1556 variable 'bash_is_sh' in your '.vimrc' file:
1557 >  let bash_is_sh = 1
1558 If some buffers use bash for sh, use the buffer-local variable:
1559 >  let b:is_bash = 1
1560 You can force using the korn shell by sett a buffer-local variable:
1561 >  let b:is_kornshell = 1
1563 To choose between the two ways to treat single-quotes inside a pair of
1564 double-quotes, I have introduced a Vim variable "highlight_balanced_quotes".
1565 By default (ie by not declaring this variable) single quotes can be used
1566 inside double quotes, and are not highlighted.  If you prefer balanced single
1567 quotes as I do you just make the statement in your .vimrc file:
1568 >  let highlight_balanced_quotes = 1
1570 Similar I have introduced another vim variable "highlight_function_name" to be
1571 used to enable/disable highlighting of the function-name in function
1572 declaration.  Default is not to highlight the function name.  If you want to
1573 highlight functions names, include this in your .vimrc file:
1574 >  let highlight_function_name = 1
1576 If you notice highlighting errors while scrolling backwards, which are fixed
1577 when redrawing with CTRL-L, try setting the "sh_minlines" internal variable
1578 to a larger number:
1579 >  let sh_minlines = 200
1580 This will make the syntax synchronization start 200 lines before the first
1581 displayed line.  The default value is 100.  The disadvantage of using a larger
1582 number is that redrawing can become slow.
1584 If you don't have much to synchronize on, displaying can be very slow.  To
1585 reduce this, the "sh_maxlines" internal variable can be set:
1586 >  let sh_maxlines = 100
1587 The default is to use the double of "sh_minlines".  Set it to a smaller number
1588 to speed up displaying.  The disadvantage is that highlight errors may appear.
1591 SPEEDUP (AspenTech plant simulator)                             *spup.vim*
1593 The Speedup syntax file has some options:
1595 - strict_subsections : If this variable is defined, only keywords for
1596   sections and subsections will be highlighted as statements but not
1597   other keywords (like WITHIN in the OPERATION section).
1599 - highlight_types : Definition of this variable causes stream types
1600   like temperature or pressure to be highlighted as Type, not as a
1601   plain Identifier. Included are the types that are usually found in
1602   the DECLARE section; if you defined own types, you have to include
1603   them in the syntax file.
1605 - oneline_comments : this value ranges from 1 to 3 and determines the
1606   highlighting of # style comments.
1608   oneline_comments = 1 : allow normal Speedup code after an even
1609   number of #s.
1611   oneline_comments = 2 : show code starting with the second # as
1612   error. This is the default setting.
1614   oneline_comments = 3 : show the whole line as error if it contains
1615   more than one #.
1617 Since especially OPERATION sections tend to become very large due to
1618 PRESETting variables, syncing may be critical. If your computer is
1619 fast enough, you can increase minlines and/or maxlines near the end of
1620 the syntax file.
1623 TEX                                                     *tex.vim*
1625 The tex highlighting supports TeX, LaTeX, and some AmsTeX.  The
1626 highlighting supports three primary zones: normal, texZone, and texMathZone.
1627 Although a considerable effort has been made to have these zones terminate
1628 properly, zones delineated by $..$ and $$..$$ cannot be synchronized as
1629 there's no difference between start and end patterns.  Consequently, a
1630 special "TeX comment" has been provided
1631 > %stopzone
1632 which will forcibly terminate the highlighting of either a texZone or a
1633 texMathZone.
1635 If you have a slow computer, you may wish to reduce the values for
1636 >  syn sync maxlines=200
1637 >  syn sync minlines=50
1638 (especially the latter).  If your computer is fast, you may wish to
1639 increase them.  This primarily affects synchronizing (ie. just what group,
1640 if any, is the text at the top of the screen supposed to be in?).
1642 The <tex.vim> supports lexical error checking of various sorts.  Thus,
1643 although the error checking is ofttimes very useful, it can indicate
1644 errors where none actually are.  If this proves to be a problem for you,
1645 you may put in your <.vimrc> the following statement:
1646 >  let tex_no_error=1
1647 and all error checking by <tex.vim> will be suppressed.
1650 TF                                                      *tf.vim*
1652 There is one option for the tf syntax highlighting.
1654 For syncing, minlines defaults to 100.  If you prefer another value, you can
1655 set "tf_minlines" to the value you desire.  Example:
1657 >  let tf_minlines = your choice
1660 X Pixmaps (XPM)                                         *xpm.vim*
1662 xpm.vim creates its syntax items dynamically based upon the contents of the
1663 XPM file.  Thus if you make changes e.g. in the color specification strings,
1664 you have to source it again e.g. with ":set syn=xpm".
1666 To copy a pixel with one of the colors, yank a "pixel" with "yl" and insert it
1667 somewhere else with "P".
1669 Do you want to draw with the mouse?  Try the following:
1670 >   function! GetPixel()
1671 >      let c = getline(line("."))[col(".") - 1]
1672 >      echo c
1673 >      exe "noremap <LeftMouse> <LeftMouse>r".c
1674 >      exe "noremap <LeftDrag>  <LeftMouse>r".c
1675 >   endfunction
1676 >   noremap <RightMouse> <LeftMouse>:call GetPixel()<CR>
1677 >   set guicursor=n:hor20          " to see the color beneath the cursor
1678 This turns the right button into a pipette and the left button into a pen.
1679 It will work with XPM files that have one character per pixel only and you
1680 must not click outside of the pixel strings, but feel free to improve it.
1682 It will look much better with a font in a quadratic cell size, e.g. for X:
1683 >   set guifont=-*-clean-medium-r-*-*-8-*-*-*-*-80-*
1685 ==============================================================================
1686 5. Defining a syntax                                    *:syn-define*
1688 Vim understands three types of syntax items:
1689 1. A keyword.  It can only contain keyword characters, according to the
1690    'iskeyword' option.  It cannot contain other syntax items.  It will only
1691    be recognized when it is a complete match (there are no keyword
1692    characters before or after the match).  "if" would match in "if(a=b)",
1693    but not in "ifdef x".
1694 2. A match.  This is a match with a single regexp pattern.  It must be within
1695    one line.
1696 3. A region.  This starts at a match of the start regexp pattern and
1697    ends with a match with the end regexp pattern.  A skip regexp pattern can
1698    be used to avoid matching the end pattern.
1700 Several syntax ITEMs can be put into one syntax GROUP.  For a syntax group
1701 you can give highlighting attributes.  For example, you could have an item
1702 to define a "/* .. */" comment and another one that defines a "// .." comment,
1703 and put them both in the "Comment" group.  You can then specify that a
1704 "Comment" will be in bold font and have a blue color.  You are free to make
1705 one highlight group for one syntax item, or put all items into one group.
1706 This depends on how you want to specify your highlighting attributes.  Putting
1707 each item in its own group results in having to specify the highlighting
1708 for a lot of groups.
1710 Note that a syntax group and a highlight group are similar.  For a highlight
1711 group you will have given highlight attributes.  These attributes will be used
1712 for the syntax group with the same name.
1714 In case more than one item matches at the same position, the one that was
1715 defined LAST wins.  Thus you can override previously defined syntax items by
1716 using an item that matches the same text.  But a keyword always goes before a
1717 match or region.  And a keyword with matching case always goes before a
1718 keyword with ignoring case.
1721 DEFINING CASE                                           *:syn-case*
1723 :sy[ntax] case [match|ignore]
1724         This defines if the following ":syntax" commands will work with
1725         matching case, when using "match", or with ignoring case, when using
1726         "ignore".  Note that any items before this are not affected, and all
1727         items until the next ":syntax case" command are affected.
1730 DEFINING KEYWORDS                                       *:syn-keyword*
1732 :sy[ntax] keyword {group-name} [{options}] {keyword} .. [{options}]
1734         This defines a number of keywords.
1736         {group-name}    Is a syntax group name such as "Comment".
1737         [{options}]     See |:syn-arguments| below.
1738         {keyword} ..    Is a list of keywords which are part of this group.
1740         Example:
1741 >  :syntax keyword   Type   int long char
1743         The {options} can be given anywhere in the line.  They will apply to
1744         all keywords given, also for options that come after a keyword.
1745         These examples do exactly the same:
1746 >  :syntax keyword   Type   contained int long char
1747 >  :syntax keyword   Type   int long contained char
1748 >  :syntax keyword   Type   int long char contained
1750         When you have a keyword with an optional tail, like Ex commands in
1751         Vim, you can put the optional characters inside [], to define all the
1752         variations at once:
1753 >  :syntax keyword   VimCommand   ab[breviate] n[ext]
1755         Don't forget that a keyword can only be recognized if all the
1756         characters are included in the 'iskeyword' option.  If one character
1757         isn't, the keyword will never be recognized.
1759         A keyword always has higher priority than a match or region, the
1760         keyword is used if more than one item matches.  Keywords do not nest
1761         and a keyword can't contain anything else.
1763         Note that when you have a keyword that is the same as an option (even
1764         one that isn't allowed here), you can not use it.  Use a match
1765         instead.
1767         The maximum length of a keyword is 80 characters.
1769         The same keyword can be defined multiple times, when its containment
1770         differs.  For example, you can define the keyword once not contained
1771         and use one highlight group, and once contained, and use a different
1772         highlight group. Example:
1773 >  :syn keyword vimCommand tag
1774 >  :syn keyword vimSetting contained tag
1775         When finding "tag" outside of any syntax item, the "vimCommand"
1776         highlight group is used.  When finding "tag" in a syntax item that
1777         contains "vimSetting", the "vimSetting" group is used.
1780 DEFINING MATCHES                                        *:syn-match*
1782 :sy[ntax] match {group-name} [{options}] [excludenl] {pattern} [{options}]
1784         This defines one match.
1786         {group-name}            A syntax group name such as "Comment".
1787         [{options}]             See |:syn-arguments| below.
1788         [excludenl]             Don't make a pattern with the end-of-line "$"
1789                                 extend a containing match or region.  Must be
1790                                 given before the pattern. |:syn-excludenl|
1791         {pattern}               The search pattern that defines the match.
1792                                 See |:syn-pattern| below.
1794         Example (match a character constant):
1795 >  :syntax match Character /'.'/s+1e-1
1798 DEFINING REGIONS        *:syn-region* *:syn-start* *:syn-skip* *:syn-end*
1800 :sy[ntax] region {group-name} [{options}]
1801                 [matchgroup={group_name}]
1802                 [keepend]
1803                 [excludenl]
1804                 start={start_pattern} ..
1805                 [skip={skip_pattern}]
1806                 end={end_pattern} ..
1807                 [{options}]
1809         This defines one region.  It may span several lines.
1811         {group-name}            A syntax group name such as "Comment".
1812         [{options}]             See |:syn-arguments| below.
1813         [matchgroup={group-name}]  The syntax group to use for the following
1814                                 start or end pattern matches only.  Not used
1815                                 for the text in between the matched start and
1816                                 end patterns.  Use NONE to reset to not using
1817                                 a different group for the start or end match.
1818                                 See |:syn-matchgroup|.
1819         keepend                 Don't allow contained matches to go past a
1820                                 match with the end pattern.  See
1821                                 |:syn-keepend|.
1822         excludenl               Don't make a pattern with the end-of-line "$"
1823                                 extend a containing match or item.  Only
1824                                 useful for end patterns.  Must be given before
1825                                 the patterns it applies to. |:syn-excludenl|
1826         start={start_pattern}   The search pattern that defines the start of
1827                                 the region.  See |:syn-pattern| below.
1828         skip={skip_pattern}     The search pattern that defines text inside
1829                                 the region where not to look for the end
1830                                 pattern.  See |:syn-pattern| below.
1831         end={end_pattern}       The search pattern that defines the end of
1832                                 the region.  See |:syn-pattern| below.
1834         Example:
1835 >  :syntax region String   start=+"+  skip=+\\"+  end=+"+
1837         The start/skip/end patterns and the options can be given in any order.
1838         There can be zero or one skip pattern.  There must be one or more
1839         start and end patterns.  This means that you can omit the skip
1840         pattern, but you must give at least one start and one end pattern.  It
1841         is allowed to have white space before and after the equal sign
1842         (although it mostly looks better without white space).
1844         When more than one start pattern is given, a match with one of these
1845         is sufficient.  This means there is an OR relation between the start
1846         patterns.  The last one that matches is used.  The same is true for
1847         the end patterns.
1849         The search for the end pattern starts right after the start pattern.
1850         Offsets are not used for this.  This implies that the match for the
1851         end pattern will never overlap with the start pattern.
1853         Note: The decision to start a region is only based on a matching start
1854         pattern.  There is no check for a matching end pattern.  This does NOT
1855         work:
1856                 :syn region First  start="("  end="."
1857                 :syn region Second start="("  end=";"
1858         The Second always matches before the First (last defined pattern has
1859         higher priority).  The Second region then continues until the next
1860         ';', no matter if there is a '.' before it.
1862                                                         *:syn-keepend*
1863         By default, a contained match can obscure a match for the end pattern.
1864         This is useful for nesting.  For example, a region that starts with
1865         "{" and ends with "}", can contain another region.  An encountered "}"
1866         will then end the contained region, but not the outer region:
1867             {           starts outer "{}" region
1868                 {       starts contained "{}" region
1869                 }       ends contained "{}" region
1870             }           ends outer "{} region
1871         If you don't want this, the "keepend" argument will make the matching
1872         of an end pattern of the outer region also end any contained item.
1873         This makes it impossible to nest the same region, but allows for
1874         contained items to highlight parts of the end pattern, without causing
1875         that to skip the match with the end pattern.  Example:
1876 >  :syn match  VimComment +"[^"]\+$+
1877 >  :syn region VimCommand start="set" end="$" contains=VimComment keepend
1878         The "keepend" makes the VimCommand always end at the end of the line,
1879         even though the contained VimComment includes a match with the <EOL>.
1881         When "keepend" is not used, a match with an end pattern is retried
1882         after each contained match.  When "keepend" is included, the first
1883         encountered match with an end pattern is used, truncating any
1884         contained matches.
1886                                                         *:syn-excludenl*
1887         When a pattern for a match or end pattern of a region includes a '$'
1888         to match the end-of-line, it will make an item that it is contained in
1889         continue on the next line.  For example, a match with "\\$" (backslash
1890         at the end of the line) can make a match continue that would normally
1891         stop at the end of the line.  This is the default behaviour.  If this
1892         is not wanted, there are two ways to avoid it:
1893         1. Use "keepend" for the the containing item.  This will keep all
1894            contained matches from extending the match or region.  It can be
1895            used when all contained items must not extend the containing item.
1896         2. Use "excludenl" in the contained item.  This will keep that match
1897            from extending the containing match or region.  It can be used if
1898            only some contained items must not extend the containing item.
1899            "excludenl" must be given before the pattern it applies to.
1901                                                         *:syn-matchgroup*
1902         "matchgroup" can be used to highlight the start and/or end pattern
1903         differently than the body of the region.  Example:
1904 >  :syntax region String matchgroup=Quote start=+"+  skip=+\\"+  end=+"+
1905         This will highlight the quotes with the "Quote" group, and the text in
1906         between with the "String" group.
1907         The "matchgroup" is used for all start and end patterns that follow,
1908         until the next "matchgroup".  Use "matchgroup=NONE" to go back to not
1909         using a matchgroup.
1911         In a start or end pattern that is highlighted with "matchgroup" the
1912         contained items of the region are not used.  This can be used to avoid
1913         that a contained item matches in the start or end pattern.  When using
1914         "transparent", it does not apply to a start or end pattern that is
1915         highlighted with "matchgroup".
1917         Here is an example, which highlights three levels of parentheses in
1918         different colors:
1919 >  sy region par1 matchgroup=hl1 start=/(/ end=/)/ contains=par2
1920 >  sy region par2 matchgroup=hl2 start=/(/ end=/)/ contains=par3 contained
1921 >  sy region par3 matchgroup=hl3 start=/(/ end=/)/ contains=par1 contained
1922 >  hi hl1 ctermfg=red guifg=red
1923 >  hi hl2 ctermfg=blue guifg=blue
1924 >  hi hl3 ctermfg=darkgreen guifg=darkgreen
1926 ==============================================================================
1927 6. :syntax arguments                                    *:syn-arguments*
1929 The :syntax commands that define syntax items take a number of arguments.
1930 The common ones are explained here.  The arguments may be given in any order
1931 and may be mixed with patterns.
1933 Not all commands accept all arguments.  This table shows which arguments
1934 can be used for each command:
1936                  contained  nextgroup  skip*   transparent  contains  oneline ~
1937 :syntax keyword     yes        yes      yes        yes         -         -
1938 :syntax match       yes        yes      yes        yes        yes        -
1939 :syntax region      yes        yes      yes        yes        yes       yes
1942 contained                                               *:syn-contained*
1944 When the "contained" argument is given, this item will not be recognized at
1945 the top level, but only when it is mentioned in the "contains" field of
1946 another match.  Example:
1947 >   :syntax keyword Todo    TODO    contained
1948 >   :syntax match   Comment "//.*"  contains=Todo
1951 transparent                                             *:syn-transparent*
1953 If the "transparent" argument is given, this item will not be highlighted
1954 itself, but will take the highlighting of the item it is contained in.  This
1955 is useful for syntax items that don't need any highlighting but are used
1956 only to skip over a part of the text.
1958 The "contains=" argument is also inherited from the item it is contained in,
1959 unless a "contains" argument is given for the transparent item itself.  To
1960 avoid that unwanted items are contained, use "contains=NONE".  Example, which
1961 highlights words in strings, but makes an exception for "vim":
1962 >       syn match myString /'[^']*'/ contains=myWord,myVim
1963 >       syn match myWord   /\<[a-z]*\>/ contained
1964 >       syn match myVim    /\<vim\>/ transparent contained contains=NONE
1965 >       hi link myString String
1966 >       hi link myWord   Comment
1967 Since the "myVim" match comes after "myWord" it is the preferred match (last
1968 match in the same position overrules an earlier one).  The "transparent"
1969 argument makes the "myVim" match use the same highlighting as "myString".  But
1970 it does not contain anything.  If the "contains=NONE" argument would be left
1971 out, then "myVim" would use the contains argument from myString and allow
1972 "myWord" to be contained, which will be highlighted as a Constant.  This
1973 happens because a contained match doesn't match inside itself in the same
1974 position, thus the "myVim" match doesn't overrule the "myWord" match here.
1976 When you look at the colored text, it is like looking at layers of contained
1977 items.  The contained item is on top of the item it is contained in, thus you
1978 see the contained item.  When a contained item is transparent, you can look
1979 through, thus you see the item it is contained in.  In a picture:
1981                 look from here
1983             |   |   |   |   |   |
1984             V   V   V   V   V   V
1986                xxxx       yyy           more contained items
1987             ....................        contained item (transparent)
1988         =============================   first item
1990 The 'x', 'y' and '=' represent a highlighted syntax item.  The '.' represent a
1991 transparent group.
1993 What you see is:
1995         =======xxxx=======yyy========
1997 Thus you look through the transparent "....".
2000 oneline                                                 *:syn-oneline*
2002 The "oneline" argument indicates that the region does not cross a line
2003 boundary.  It must match completely in the current line.  However, when the
2004 region has a contained item that does cross a line boundary, it continues on
2005 the next line anyway.  A contained item can be used to recognize a line
2006 continuation pattern.
2009 contains={groupname},..                                 *:syn-contains*
2011 The "contains" argument is followed by a list of syntax group names.  These
2012 groups will be allowed to begin inside the item (they may extend past the
2013 containing group's end).  This allows for recursive nesting of matches and
2014 regions.  If there is no "contains" argument, no groups will be contained in
2015 this item.  The group names do not need to be defined before they can be used
2016 here.
2018 contains=ALL
2019                 If the only item in the contains list is "ALL", then all
2020                 groups will be accepted inside the item.
2022 contains=ALLBUT,{group-name},..
2023                 If the first item in the contains list is "ALLBUT", then all
2024                 groups will be accepted inside the item, except the ones that
2025                 are listed, and the "contained" items.  Example:
2026 >  :syntax region Block start="{" end="}" ... contains=ALLBUT,Function
2028 The {group-name} in the "contains" list can be a pattern.  All group names
2029 that match the pattern will be included (or excluded, if "ALLBUT" is used).
2030 The pattern cannot contain white space or a ','.  Example:
2031 >  ... contains=Comment.*,Keyw[0-3]
2032 The matching will be done at moment the syntax command is executed.  Groups
2033 that are defined later will not be matched.  Also, if the current syntax
2034 command defines a new group, this is not matched.  Be careful: When putting
2035 syntax commands in a file you can't rely on groups NOT being defined, because
2036 the file may have been sourced before, and "syn clear" doesn't remove the
2037 group names.
2039 The contained groups will also match in the start and end patterns of a
2040 region.  If this is not wanted, the "matchgroup" argument can be used
2041 |:syn-matchgroup|.  The "ms=" and "me=" offsets can be used to change the
2042 region where contained items do match.  Note that this may also limit the
2043 area that is highlighted
2046 nextgroup={groupname},..                                *:syn-nextgroup*
2048 The "nextgroup" argument is followed by a list of syntax group names,
2049 separated by commas (just like with "contains", so you can also use patterns).
2051 If the "nextgroup" argument is given, the mentioned syntax groups will be
2052 tried for a match, after the match or region ends.  If none of the groups have
2053 a match, highlighting continues normally.  If there is a match, this group
2054 will used, even when it is not mentioned in the "contains" field of the
2055 current group.  This is like giving the mentioned group priority over all
2056 other groups.  Example:
2057 >   :syntax match  ccFoobar  "Foo.\{-}Bar"  contains=ccFoo
2058 >   :syntax match  ccFoo     "Foo"          contained nextgroup=ccFiller
2059 >   :syntax region ccFiller  start="."  matchgroup=ccBar  end="Bar"  contained
2061 This will highlight "Foo" and "Bar" differently, and only when there is a
2062 "Bar" after "Foo".  In the text line below, "f" shows where ccFoo is used for
2063 highlighting, and "bbb" where ccBar is used.
2065 >   Foo asdfasd Bar asdf Foo asdf Bar asdf
2066 >   fff         bbb      fff      bbb
2068 Note the use of ".\{-}" to skip as little as possible until the next Bar.
2069 when ".*" would be used, the "asdf" in between "Bar" and "Foo" would be
2070 highlighted according to the "ccFoobar" group, because the ccFooBar match
2071 would include the first "Foo" and the last "Bar" in the line (see |pattern|).
2074 skipwhite                                               *:syn-skipwhite*
2075 skipnl                                                  *:syn-skipnl*
2076 skipempty                                               *:syn-skipempty*
2078 These arguments are only used in combination with "nextgroup".  They can be
2079 used to allow the next group to match after skipping some text:
2080         skipwhite       skip over space and Tab characters
2081         skipnl          skip over the end of a line
2082         skipempty       skip over empty lines (implies a "skipnl")
2084 When "skipwhite" is present, the white space is only skipped if there is no
2085 next group that matches the white space.
2087 When "skipnl" is present, the match with nextgroup may be found in the next
2088 line.  This only happens when the current item ends at the end of the current
2089 line!  When "skipnl" is not present, the nextgroup will only be found after
2090 the current item in the same line.
2092 When skipping text while looking for a next group, the matches for other
2093 groups are ignored.  Only when no next group matches, other items are tried
2094 for a match again.  This means that matching a next group and skipping white
2095 space and <EOL>s has a higher priority than other items.
2097 Example:
2098 >  syn match ifstart "if.*"     nextgroup=ifline skipwhite skipempty
2099 >  syn match ifline  "endif"    contained
2100 >  syn match ifline  "[^ \t].*" nextgroup=ifline skipwhite skipempty contained
2101 Note that the last match, which matches any non-white text, is put last,
2102 otherwise the "endif" of the indent would never match, because the "[^ \t].*"
2103 would match first.
2104 Note that this example doesn't work for nested "if"s.  You need to add
2105 "contains" arguments to make that work (omitted for simplicity of the
2106 example).
2108 ==============================================================================
2109 7. Syntax patterns                                      *:syn-pattern*
2111 In the syntax commands, a pattern must be surrounded by two identical
2112 characters.  This is like it works for the ":s" command.  The most common to
2113 use is the double quote.  But if the pattern contains a double quote, you can
2114 use another character that is not used in the pattern.  Examples:
2115 >  :syntax region Comment  start="/\*"  end="\*/"
2116 >  :syntax region String   start=+"+    end=+"+   skip=+\\"+
2118 See |pattern| for the explanation of what a pattern is.  Syntax patterns are
2119 always interpreted like the 'magic' options is set, no matter what the actual
2120 value of 'magic' is.  And the patterns are interpreted like the 'l' flag is
2121 not included in 'cpoptions'.  This was done to make syntax files portable and
2122 independent of 'compatible' and 'magic' settings.
2124 Try to avoid patterns that can match an empty string, such as "[a-z]*".
2125 This slows down the highlighting a lot, because it matches everywhere.
2127 The pattern can be followed by a character offset.  This can be used to
2128 change the highlighted part, and to change the text area included in the
2129 match or region (which only matters when trying to match other items).  Both
2130 are relative to the matched pattern.  The character offset for a skip
2131 pattern can be used to tell where to continue looking for an end pattern.
2133 The offset takes the form of "{what}={offset}"
2134 The {what} can be one of seven strings:
2136 ms      Match Start     offset for the start of the matched text
2137 me      Match End       offset for the end of the matched text
2138 hs      Highlight Start offset for where the highlighting starts
2139 he      Highlight End   offset for where the highlighting ends
2140 rs      Region Start    offset for where the body of a region starts
2141 re      Region End      offset for where the body of a region ends
2142 lc      Leading Context offset past "leading context" of pattern
2144 The {offset} can be:
2146 s       start of the matched pattern
2147 s+{nr}  start of the matched pattern plus {nr} chars to the right
2148 s-{nr}  start of the matched pattern plus {nr} chars to the left
2149 e       end of the matched pattern
2150 e+{nr}  end of the matched pattern plus {nr} chars to the right
2151 e-{nr}  end of the matched pattern plus {nr} chars to the left
2152 {nr}    (for "lc" only): start matching {nr} chars to the left
2154 Examples: "ms=s+1", "hs=e-2", "lc=3".
2156 Although all offsets are accepted after any pattern, they are not always
2157 meaningful.  This table shows which offsets are actually used:
2159                     ms   me   hs   he   rs   re   lc ~
2160 match item          yes  yes  yes  yes  -    -    yes
2161 region item start   yes  -    yes  -    yes  -    yes
2162 region item skip    -    yes  -    -    -    -    -
2163 region item end     -    yes  -    yes  -    yes  -
2165 Offsets can be concatenated, with a ',' in between.  Example:
2166 >  syn match String  /"[^"]*"/hs=s+1,he=e-1
2168     some "string" text
2169           ^^^^^^                highlighted
2171 Notes:
2172 - There must be no white space between the pattern and the character
2173   offset(s).
2174 - The highlighted area will never be outside of the matched text.
2175 - A negative offset for an end pattern may not always work, because the end
2176   pattern may be detected when the highlighting should already have stopped.
2178 Example (match a comment but don't highlight the /* and */):
2179 >  :syntax region Comment start="/\*"hs=e+1 end="\*/"he=s-1
2181         /* this is a comment */
2182           ^^^^^^^^^^^^^^^^^^^     highlighted
2184 A more complicated Example:
2185 >  :syn region Exa matchgroup=Foo start="foo"hs=s+2,rs=e+2 matchgroup=Bar end="bar"me=e-1,he=e-1,re=s-1
2187          abcfoostringbarabc
2188             mmmmmmmmmmm     match
2189               ssrrrreee     highlight start/region/end ("Foo", "Exa" and "Bar")
2191 Leading context                 *:syn-lc* *:syn-leading* *:syn-context*
2193 The "lc" offset specifies leading context -- a part of the pattern that must
2194 be present, but is not considered part of the match.  An offset of "lc=n" will
2195 cause Vim to step back n columns before attempting the pattern match, allowing
2196 characters which have already been matched in previous patterns to also be
2197 used as leading context for this match.  This can be used, for instance, to
2198 specify that an "escaping" character must not precede the match:
2200 >  :syn match ZNoBackslash "[^\\]z"ms=s+1
2201 >  :syn match WNoBackslash "[^\\]w"lc=1
2202 >  :syn match Underline "_\+"
2204           ___zzzz ___wwww
2205           ^^^     ^^^     matches Underline
2206               ^ ^         matches ZNoBackslash
2207                      ^^^^ matches WNoBackslash
2209 The "ms" offset is automatically set to the same value as the "lc" offset,
2210 unless you set "ms" explicitly.
2212 ==============================================================================
2213 8. Syntax clusters                                      *:syn-cluster*
2215 :sy[ntax] cluster {cluster-name} [contains={group-name}..]
2216                                  [add={group-name}..]
2217                                  [remove={group-name}..]
2219 This command allows you to cluster a list of syntax groups together under a
2220 single name.
2222         contains={group-name}..
2223                 The cluster is set to the specified list of groups.
2224         add={group-name}..
2225                 The specified groups are added to the cluster.
2226         remove={group-name}..
2227                 The specified groups are removed from the cluster.
2229 A cluster so defined may be referred to in a contains=.., nextgroup=.., add=..
2230 or remove=.. list with a "@" prefix.  You can also use this notation to
2231 implicitly declare a cluster before specifying its contents.
2233 Example:
2234 >   :syntax match Thing "# [^#]\+ #" contains=@ThingMembers
2235 >   :syntax cluster ThingMembers contains=ThingMember1,ThingMember2
2237 As the previous example suggests, modifications to a cluster are effectively
2238 retroactive; the membership of the cluster is checked at the last minute, so
2239 to speak:
2240 >   :syntax keyword A aaa
2241 >   :syntax cluster AandB contains=A
2242 >   :syntax match Stuff "( aaa bbb )" contains=@AandB
2243 >   :syntax cluster AandB add=B    " now both keywords are matched in Stuff
2245 This also has implications for nested clusters:
2246 >   :syntax keyword A aaa
2247 >   :syntax keyword B bbb
2248 >   :syntax cluster SmallGroup contains=B
2249 >   :syntax cluster BigGroup contains=A,@SmallGroup
2250 >   :syntax match Stuff "( aaa bbb )" contains=@BigGroup
2251 >   :syntax cluster BigGroup remove=B    " no effect, since B isn't in BigGroup
2252 >   :syntax cluster SmallGroup remove=B  " now bbb isn't matched within Stuff
2254 ==============================================================================
2255 9. Including syntax files                               *:syn-include*
2257 It is often useful for one language's syntax file to include a syntax file for
2258 a related language.  Depending on the exact relationship, this can be done in
2259 two different ways:
2261         - If top-level syntax items in the included syntax file are to be
2262           allowed at the top level in the including syntax, you can simply use
2263           the |:source| command:
2265 >  " In cpp.vim:
2266 >  :source <sfile>:p:h/c.vim
2268         - If top-level syntax items in the included syntax file are to be
2269           contained within a region in the including syntax, you can use the
2270           ":syntax include" command:
2272 :sy[ntax] include [@{grouplist-name}] {file-name}
2274           All syntax items declared in the included file will have the
2275           "contained" flag added.  In addition, if a group list is specified,
2276           all top-level syntax items in the included file will be added to
2277           that list.
2279 >   " In perl.vim:
2280 >   :syntax include @Pod <sfile>:p:h/pod.vim
2281 >   :syntax region perlPOD start="^=head" end="^=cut" contains=@Pod
2283 ==============================================================================
2284 10. Synchronizing                                       *:syn-sync*
2286 Vim wants to be able to start redrawing in any position in the document.  To
2287 make this possible it needs to know the syntax item at the position where
2288 redrawing starts.
2290 :sy[ntax] sync [ccomment [group-name] | minlines={N} | ...]
2292 There are three ways to synchronize:
2293 1. Based on C-style comments.  Vim understands how C-comments work and can
2294    figure out if the current line starts inside or outside a comment.
2295    |:syn-sync-first|
2296 2. Jumping back a certain number of lines and start parsing there.
2297    |:syn-sync-second|
2298 3. Searching backwards in the text for a pattern to sync on.
2299    |:syn-sync-third|
2301                                 *:syn-sync-maxlines* *:syn-sync-minlines*
2302 For all three methods, the line range where the parsing can start is limited
2303 by "minlines" and "maxlines".
2305 If the "minlines={N}" argument is given, the parsing always starts at least
2306 that many lines backwards.  This can be used if the parsing may take a few
2307 lines before it's correct, or when it's not possible to use syncing.
2309 If the "maxlines={N}" argument is given, the number of lines that are searched
2310 for a comment or syncing pattern is restricted to N lines backwards (after
2311 adding "minlines".  This is useful if you have few things to sync on and a
2312 slow machine.  Example:
2313 >  :syntax sync ccomment maxlines=500
2316 First syncing method:                   *:syn-sync-first* *:syn-sync-ccomment*
2318 For the first method, only the "ccomment" argument needs to be given.
2319 Example:
2320 >  :syntax sync ccomment
2322 When Vim finds that the line where displaying starts is inside a C-style
2323 comment, the last region syntax item with the group-name "Comment" will be
2324 used.  This requires that there is a region with the group-name "Comment"!
2325 An alternate group name can be specified, for example:
2326 >  :syntax sync ccomment javaComment
2327 This means that the last item specified with "syn region javaComment" will be
2328 used for the detected C comment region.  This only works properly if that
2329 region does have a start pattern "\/*" and an end pattern "*\/".
2331 The "maxlines" argument can be used to restrict the search to a number of
2332 lines.  The "minlines" argument can be used to at least start a number of
2333 lines back (e.g., for when there is some construct that only takes a few
2334 lines, but it hard to sync on).
2336 Note: Syncing on a C comment doesn't work properly when strings are used
2337 that cross a line and contain a "*/".  Since letting strings cross a line
2338 is a bad programming habit (many compilers give a warning message), and the
2339 chance of a "*/" appearing inside a comment is very small, this restriction
2340 is hardly ever noticed.
2343 Second syncing method:                          *:syn-sync-second*
2345 For the second method, only the "minlines={N}" argument needs to be given.
2346 Vim will subtract {N} from the line number and start parsing there.  This
2347 means {N} extra lines need to be parsed, which makes this method a bit slower.
2348 Example:
2349 >  :syntax sync minlines=50
2351 "lines" is equivalent to "minlines" (used by older versions).
2354 Third syncing method:                           *:syn-sync-third*
2356 The idea is to synchronize on the end of a few specific regions, called a
2357 sync pattern.  Only regions can cross lines, so when we find the end of some
2358 region, we might be able to know in which syntax item we are.  The search
2359 starts in the line just above the one where redrawing starts.  From there
2360 the search continues backwards in the file.
2362 This works just like the non-syncing syntax items.  You can use contained
2363 matches, nextgroup, etc.  But there are a few differences:
2364 - Keywords cannot be used.
2365 - The syntax items with the "sync" keyword form a completely separated group
2366   of syntax items.  You can't mix syncing groups and non-syncing groups.
2367 - The matching works backwards in the buffer (line by line), instead of
2368   forwards.
2369 - A line continuation pattern can be given.  It is used to decide which group
2370   of lines need to be searched like they were one line.  This means that the
2371   search for a match with the specified items starts in the first of the
2372   consecutive that contain the continuation pattern.
2373 - When using "nextgroup" or "contains", this only works within one line (or
2374   group of continued lines).
2375 - When a match with a sync pattern is found, the rest of the line (or group of
2376   continued lines) is searched for another match.  The last match is used.
2377   This is used when a line can contain both the start end the end of a region
2378   (e.g., in a C-comment like /* this */, the last "*/" is used).
2380 There are two ways how a match with a sync pattern can be used:
2381 1. Parsing for highlighting starts where redrawing starts (and where the
2382    search for the sync pattern started).  The syntax group that is expected
2383    to be valid there must be specified.  This works well when the regions
2384    that cross lines cannot contain other regions.
2385 2. Parsing for highlighting continues just after the match.  The syntax group
2386    that is expected to be present just after the match must be specified.
2387    This can be used when the previous method doesn't work well.  It's much
2388    slower, because more text needs to be parsed.
2389 Both types of sync patterns can be used at the same time.
2391 Besides the sync patterns, other matches and regions can be specified, to
2392 avoid finding unwanted matches.
2394 [The reason that the sync patterns are given separately, is that mostly the
2395 search for the sync point can be much simpler than figuring out the
2396 highlighting.  The reduced number of patterns means it will go (much)
2397 faster.]
2399                                                 *syn-sync-grouphere*
2400     :syntax sync match {sync-group-name} grouphere {group-name} "pattern" ..
2402         Define a match that is used for syncing.  {group-name} is the
2403         name of a syntax group that follows just after the match.  Parsing
2404         of the text for highlighting starts just after the match.  A region
2405         must exist for this {group-name}.  The first one defined will be used.
2406         "NONE" can be used for when there is no syntax group after the match.
2408                                                 *syn-sync-groupthere*
2409     :syntax sync match {sync-group-name} groupthere {group-name} "pattern" ..
2411         Like "grouphere", but {group-name} is the name of a syntax group that
2412         is to be used at the start of the line where searching for the sync
2413         point started.  The text between the match and the start of the sync
2414         pattern searching is assumed not to change the syntax highlighting.
2415         For example, in C you could search backwards for "/*" and "*/".  If
2416         "/*" is found first, you know that you are inside a comment, so the
2417         "groupthere" is "cComment".  If "*/" is found first, you know that you
2418         are not in a comment, so the "groupthere" is "NONE".  (in practice
2419         it's a bit more complicated, because the "/*" and "*/" could appear
2420         inside a string.  That's left as an exercise to the reader...).
2422     :syntax sync match ..
2423     :syntax sync region ..
2425         Without a "groupthere" argument.  Define a region or match that is
2426         skipped while searching for a sync point.
2428     :syntax sync linecont {pattern}
2430         When {pattern} matches in a line, it is considered to continue in
2431         the next line.  This means that the search for a sync point will
2432         consider the lines to be concatenated.
2434 If the "maxlines={N}" argument is given too, the number of lines that are
2435 searched for a match is restricted to N.  This is useful if you have very
2436 few things to sync on and a slow machine.  Example:
2437 >  :syntax sync maxlines=100
2439 You can clear all sync settings with:
2440 >  :syntax sync clear
2442 You can clear specific sync patterns with:
2443 >  :syntax sync clear {sync-group-name} ..
2445 ==============================================================================
2446 11. Listing syntax items                                *:syntax* *:sy* *:syn*
2448 This commands lists all the syntax items:
2450     :sy[ntax] [list]
2452 To show the syntax items for one syntax group:
2454     :sy[ntax] list {group-name}
2456 To list the syntax groups in one cluster:
2458     :sy[ntax] list @{cluster-name}
2460 See above for other arguments for the ":syntax" command.
2462 Note that the ":syntax" command can be abbreviated to ":sy", although ":syn"
2463 is mostly used, because it looks better.
2465 ==============================================================================
2466 12. Highlight command                                   *:highlight* *:hi*
2468 There are two types of highlight groups:
2469 - The ones used for specific languages.  For these the name starts with the
2470   name of the language.  Many of these don't have any attributes, but are
2471   linked to a group of the second type.
2472 - The ones used for all languages.  These are also used for the 'highlight'
2473   option.
2474                                                         *hitest.vim*
2475 You can see all the groups currently active with this command:
2476 >   :so $VIMRUNTIME/syntax/hitest.vim
2477 This will open a new window containing all highlight group names, displayed
2478 in their own color.
2480 :hi[ghlight]            List all the current highlight groups that have
2481                         attributes set.
2483 :hi[ghlight] {group-name}
2484                         List one highlight group.
2486 :hi[ghlight] clear {group-name}
2487 :hi[ghlight] {group-name} NONE
2488                         Disable the highlighting for one highlight group.
2490 :hi[ghlight] [default] {group-name} {key}={arg} ..
2491                         Add a highlight group, or change the highlighting for
2492                         an existing group.
2493                         See |highlight-args| for the {key}={arg} arguments.
2494                         See |:highlight-default| for the optional [default]
2495                         argument.
2497 Normally a highlight group is added once, in the *.vim file.  This sets
2498 the default values for the highlighting.  After that, you can use additional
2499 highlight commands to change the arguments that you want to set to
2500 non-default values.  The value "NONE" can be used to switch the value off or
2501 go back to the default value.
2503 Example.  The syntax.vim file contains this line:
2504 >  hi Comment   term=bold ctermfg=Cyan guifg=#80a0ff
2506 You can change this by giving another ":highlight: command:
2507 >  hi Comment   gui=bold
2509 Note that all settings that are not included remain the same, only the
2510 specified field is used, and settings are merged with previous ones.  So, the
2511 result is like this single command has been used:
2512 >  hi Comment   term=bold ctermfg=Cyan guifg=#80a0ff gui=bold
2514                                                 *highlight-args*
2515 There are three types of terminals for highlighting:
2516 term    a normal terminal (vt100, xterm)
2517 cterm   a color terminal (MS-DOS console, color-xterm, these have the "Co"
2518         termcap entry)
2519 gui     the GUI
2521 For each type the highlighting can be given.  This makes it possible to use
2522 the same syntax file on all terminals, and use the optimal highlighting.
2524 1. highlight arguments for normal terminals
2526 term={attr-list}                                *attr-list* *highlight-term*
2527         attr-list is a comma separated list (without spaces) of the
2528         following items (in any order):
2529                 bold
2530                 underline
2531                 reverse
2532                 inverse         same as reverse
2533                 italic
2534                 standout
2535                 NONE            no attributes used (used to reset it)
2537         Note that "bold" can be used here and by using a bold font.  They
2538         have the same effect.
2540 start={term-list}                               *highlight-start*
2541 stop={term-list}                                *term-list* *highlight-stop*
2542         These lists of terminal codes can be used to get
2543         non-standard attributes on a terminal.
2545         The escape sequence specified with the "start" argument
2546         is written before the characters in the highlighted
2547         area.  It can be anything that you want to send to the
2548         terminal to highlight this area.  The escape sequence
2549         specified with the "stop" argument is written after the
2550         highlighted area.  This should undo the "start" argument.
2551         Otherwise the screen will look messed up.
2553         The {term-list} can have two forms:
2555         1. A string with escape sequences.
2556            This is any string of characters, except that it can't start with
2557            "t_" and blanks are not allowed.  The <> notation is recognized
2558            here, so you can use things like "<Esc>" and "<Space>".  Example:
2559                 start=<Esc>[27h;<Esc>[<Space>r;
2561         2. A list of terminal codes.
2562            Each terminal code has the form "t_xx", where "xx" is the name of
2563            the termcap entry.  The codes have to be separated with commas.
2564            White space is not allowed.  Example:
2565                 start=t_C1,t_BL
2566            The terminal codes must exist for this to work.
2569 2. highlight arguments for color terminals
2571 cterm={attr-list}                                       *highlight-cterm*
2572         See above for the description of {attr-list} |attr-list|.
2573         The "cterm" argument is likely to be different from "term", when
2574         colors are used.  For example, in a normal terminal comments could
2575         be underlined, in a color terminal they can be made Blue.
2576         Note: Many terminals (e.g., DOS console) can't mix these attributes
2577         with coloring.  Use only one of "cterm=" OR "ctermfg=" OR "ctermbg=".
2579 ctermfg={color-nr}                                      *highlight-ctermfg*
2580 ctermbg={color-nr}                                      *highlight-ctermbg*
2581         The {color-nr} argument is a color number.  Its range is zero to
2582         (not including) the number given by the termcap entry "Co".
2583         The actual color with this number depends on the type of terminal
2584         and its settings.  Sometimes the color also depends on the settings of
2585         "cterm".  For example, on some systems "cterm=bold ctermfg=3" gives
2586         another color, on others you just get color 3.
2588         For an xterm this depends on your resources, and is a bit
2589         unpredictable.  See your xterm documentation for the defaults.  The
2590         colors for a color-xterm can be changed from the .Xdefaults file.
2591         Unfortunately this means that it's not possible to get the same colors
2592         for each user.  See |xterm-color| for info about color xterms.
2594         The MSDOS standard colors are fixed (in a console window), so these
2595         have been used for the names.  But the meaning of color names in X11
2596         are fixed, so these color settings have been used, to make the
2597         highlighting settings portable (complicated, isn't it?).  The
2598         following names are recognized, with the color number used:
2600             NR-16   NR-8    COLOR NAME ~
2601                                                         *cterm-colors*
2602             0       0       Black
2603             1       4       DarkBlue
2604             2       2       DarkGreen
2605             3       6       DarkCyan
2606             4       1       DarkRed
2607             5       5       DarkMagenta
2608             6       3       Brown
2609             7       7       LightGray, LightGrey, Gray, Grey
2610             8       0*      DarkGray, DarkGrey
2611             9       4*      Blue, LightBlue
2612             10      2*      Green, LightGreen
2613             11      6*      Cyan, LightCyan
2614             12      1*      Red, LightRed
2615             13      5*      Magenta, LightMagenta
2616             14      3*      Yellow
2617             15      7*      White
2619         The number under "NR-16" is used for 16-color terminals ('t_Co'
2620         greater than or equal to 16).  The number under "NR-8" is used for
2621         8-color terminals ('t_Co' less than 16).  The '*' indicates that the
2622         bold attribute is set for ctermfg.  In many 8-color terminals (e.g.,
2623         "linux"), this causes the bright colors to appear.  This doesn't work
2624         for background colors!  Without the '*' the bold attribute is removed.
2625         If you want to set the bold attribute in a different way, put a
2626         "cterm=" argument AFTER the "ctermfg=" or "ctermbg=" argument.  Or use
2627         a number instead of a color name.
2629         The case of the color names is ignored.
2630         Note that for 16 color ansi style terminals (including xterms), the
2631         numbers in the NR-8 column is used. Here '*' means 'add 8' so that Blue
2632         is 12, DarkGray is 8 etc.
2634         Note that for some color terminals these names may result in the wrong
2635         colors!
2636                                                         *:hi-normal-cterm*
2637         When setting the "ctermfg" or "ctermbg" colors for the Normal group,
2638         these will become the colors used for the non-highlighted text.
2639         Example:
2640 >               :highlight Normal ctermfg=grey ctermbg=darkblue
2641         When setting the "ctermbg" color for the Normal group, the
2642         'background' option will be adjusted automatically.  This causes the
2643         highlight groups that depend on 'background' to change!  This means
2644         you should set the colors for Normal first, before setting other
2645         colors.
2647         When you have set "ctermfg" or "ctermbg" for the Normal group, Vim
2648         needs to reset the color when exiting.  This is done with the "op"
2649         termcap entry |t_op|.  If this doesn't work correctly, try setting the
2650         't_op' option in your .vimrc.
2652         When Vim knows the normal foreground and background colors, "fg" and
2653         "bg" can be used as color names.  This only works after setting the
2654         colors for the Normal group and for the MS-DOS console.  Example, for
2655         reverse video:
2656 >           :highlight Visual ctermfg=bg ctermbg=fg
2657         Note that the colors are used that are valid at the moment this
2658         command are given.  If the Normal group colors are changed later, the
2659         "fg" and "bg" colors will not be adjusted.
2662 3. highlight arguments for the GUI
2664 gui={attr-list}                                         *highlight-gui*
2665         These give the attributes to use in the GUI mode.
2666         See |attr-list| for a description.
2667         Note that "bold" can be used here and by using a bold font.  They
2668         have the same effect.
2669         Note that the attributes are ignored for the "Normal" group.
2671 font={font-name}                                        *highlight-font*
2672         font-name is the name of a font, as it is used on the system Vim
2673         runs on.  For X11 this is a complicated name, for example:
2674 >  font=-misc-fixed-bold-r-normal--14-130-75-75-c-70-iso8859-1
2676         The font-name "NONE" can be used to revert to the default font.
2677         When setting the font for the "Normal" group, this becomes the default
2678         font (until the 'guifont' option is changed; the last one set is
2679         used).  All fonts used should be of the same character size as the
2680         default font!  Otherwise redrawing problems will occur.
2681         Setting the font does not work for the "Menu" group.
2683 guifg={color-name}                                      *highlight-guifg*
2684 guibg={color-name}                                      *highlight-guibg*
2685         These give the foreground (guifg) and background (guibg) color to
2686         use in the GUI.  There are a few special names:
2687                 NONE            no color (transparent)
2688                 bg              use normal background color
2689                 background      use normal background color
2690                 fg              use normal foreground color
2691                 foreground      use normal foreground color
2692         To use a color name with an embedded space or other special character,
2693         put it in single quotes.  The single quote cannot be used then.
2694         Example:
2695 >           :hi comment guifg='salmon pink'
2697                                                         *gui-colors*
2698         Suggested color names (these are available on most systems):
2699             Red         LightRed        DarkRed
2700             Green       LightGreen      DarkGreen       SeaGreen
2701             Blue        LightBlue       DarkBlue        SlateBlue
2702             Cyan        LightCyan       DarkCyan
2703             Magenta     LightMagenta    DarkMagenta
2704             Yellow      LightYellow     Brown
2705             Gray        LightGray       DarkGray
2706             Black       White
2707             Orange      Purple          Violet
2709         In the Win32 GUI version, additional system colors are available.  See
2710         |win32-colors|.
2712         You can also specify a color by its Red, Green and Blue values.
2713         The format is "#rrggbb", where
2714                 "rr"    is the Red value
2715                 "bb"    is the Blue value
2716                 "gg"    is the Green value
2717         All values are hexadecimal, range from "00" to "ff".  Examples:
2718 >  :highlight Comment guifg=#11f0c3 guibg=#ff00ff
2720                                         *highlight-groups* *highlight-default*
2721 These are the default highlighting groups.  These groups are used by the
2722 'highlight' option default.  Note that the highlighting depends on the value
2723 of 'background'.  You can see the current settings with the ":highlight"
2724 command.
2725                                                         *hl-Cursor*
2726 Cursor          the character under the cursor
2727                                                         *hl-Directory*
2728 Directory       directory names (and other special names in listings)
2729                                                         *hl-ErrorMsg*
2730 ErrorMsg        error messages on the command line.
2731                                                         *hl-IncSearch*
2732 IncSearch       'incsearch' highlighting
2733                                                         *hl-LineNr*
2734 LineNr          line number for ":number" and ":#" commands, and when 'number'
2735                 option is set.
2736                                                         *hl-ModeMsg*
2737 ModeMsg         'showmode' message (e.g., "-- INSERT --")
2738                                                         *hl-MoreMsg*
2739 MoreMsg         |more-prompt|
2740                                                         *hl-NonText*
2741 NonText         '~' and '@' at the end of the window and characters from
2742                 'showbreak'
2743                                                         *hl-Normal*
2744 Normal          normal text
2745                                                         *hl-Question*
2746 Question        |hit-return| prompt and yes/no questions
2747                                                         *hl-Search*
2748 Search          last search pattern highlighting (see 'hlsearch')
2749                                                         *hl-SpecialKey*
2750 SpecialKey      Meta and special keys listed with ":map"
2751                                                         *hl-StatusLine*
2752 StatusLine      status line of current window
2753                                                         *hl-StatusLineNC*
2754 StatusLineNC    status lines of not-current windows
2755                                                         *hl-Title*
2756 Title           titles for output from ":set all", ":autocmd" etc.
2757                                                         *hl-Visual*
2758 Visual          Visual mode selection
2759                                                         *hl-VisualNOS*
2760 VisualNOS       Visual mode selection when vim is "Not Owning the Selection".
2761                 Only X11 Gui's |gui-x11| and |xterm-clipboard| supports this.
2762                                                         *hl-WarningMsg*
2763 WarningMsg      warning messages
2764                                                         *hl-WildMenu*
2765 WildMenu        current match in 'wildmenu' completion
2767                                                         *hl-User1..9*
2768 The 'statusline' syntax allows the use of 9 different highlights in the
2769 statusline and ruler (via 'rulerformat'). The names are User1 to User9.
2771 For the GUI you can use these groups to set the colors for the menu and
2772 scrollbars.  They don't have defaults.  This doesn't work for the Win32 GUI.
2773     Menu                                                    *hl-Menu*
2774     Scrollbar                                               *hl-Scrollbar*
2776 ==============================================================================
2777 13. Linking groups                                      *:highlight-link*
2779 When you want to use the same highlighting for several syntax groups, you
2780 can do this more easily by linking the groups into one common highlight
2781 group, and give the color attributes only for that group.
2783     :hi[ghlight][!] [default] link {from-group} {to-group}
2785 Notes:
2786 - If the {from-group} and/or {to-group} doesn't exist, it is created.  You
2787   don't get an error message for a non-existing group.
2788 - If the {to-group} is "NONE", the link is removed from the {from-group}.
2789 - As soon as you use a ":highlight" command for a linked group, the link is
2790   removed.
2791 - If there are already highlight settings for the {from-group}, the link is
2792   not made, unless the '!' is given.  For a ":highlight link" command in a
2793   sourced file, you don't get an error message.  This can be used to skip
2794   links for groups that already have settings.
2796                                                         *:highlight-default*
2797 The [default] argument is used for setting the default highlighting for a
2798 group.  If highlighting has already been specified for the group the command
2799 will be ignored.  Also when there is an existing link.
2801 Using [default] is especially useful to overrule the highlighting of a
2802 specific syntax file.  For example, the C syntax file contains:
2803 >       :highlight default link cComment Comment
2804 If you like Question highlighting for C comments, put this in your vimrc file:
2805 >       :highlight link cComment Question
2806 Without the "default" in the C syntax file, the highlighting would be
2807 overruled when the syntax file is loaded.
2809 ==============================================================================
2810 14. Cleaning up                                         *:syn-clear*
2812 If you want to clear the syntax stuff for the current buffer, you can use this
2813 command:
2814 >  :syntax clear
2816 This command should be used when you want to switch off syntax highlighting,
2817 or when you want to switch to using another syntax.  It's a good idea to
2818 include this command at the beginning of a syntax file.
2820 If you want to disable syntax highlighting for all buffers, you need to remove
2821 the autocommands that load the syntax files:
2822 >  :syntax off
2824 What this command actually does, is executing the command
2825 >  source $VIMRUNTIME/syntax/nosyntax.vim
2826 See the "nosyntax.vim" file for details.  Note that for this to work
2827 $VIMRUNTIME must be valid.  See |$VIMRUNTIME|.
2829 To clean up specific syntax groups for the current buffer:
2830 >  :syntax clear {group-name} ..
2831 This removes all patterns and keywords for {group-name}.
2833 To clean up specific syntax group lists for the current buffer:
2834 >  :syntax clear @{grouplist-name} ..
2835 This sets {grouplist-name}'s contents to an empty list.
2837 ==============================================================================
2838 15. Highlighting tags                                   *tag-highlight*
2840 If you want to highlight all the tags in your file, you can use the following
2841 mappings.
2843         <F11>   -- Generate tags.vim file, and highlight tags.
2844         <F12>   -- Just highlight tags based on existing tags.vim file.
2846 >  map <F11>  :sp tags<CR>:%s/^\([^     :]*:\)\=\([^    ]*\).*/syntax keyword Tag \2/<CR>:wq! tags.vim<CR>/^<CR><F12>
2847 >  map <F12>  :so tags.vim<CR>
2849 WARNING: The longer the tags file, the slower this will be, and the more
2850 memory Vim will consume.
2852 Only highlighting typedefs, unions and structs can be done too.  For this you
2853 must use Exuberant ctags (found at http://ctags.sf.net).
2855 Put these lines in your Makefile:
2857 # Make a highlight file for types.  Requires Exuberant ctags and awk
2858 types: types.vim
2859 types.vim: *.[ch]
2860         ctags -i=gstuS -o- *.[ch] |\
2861                 awk 'BEGIN{printf("syntax keyword Type\t")}\
2862                         {printf("%s ", $$1)}END{print ""}' > $@
2864 And put these lines in your .vimrc:
2866 >  " load the types.vim highlighting file, if it exists
2867 >  autocmd BufRead,BufNewFile *.[ch] let fname = expand('<afile>:p:h') . '/types.vim'
2868 >  autocmd BufRead,BufNewFile *.[ch] if filereadable(fname)
2869 >  autocmd BufRead,BufNewFile *.[ch]   exe 'so ' . fname
2870 >  autocmd BufRead,BufNewFile *.[ch] endif
2872 ==============================================================================
2873 16. Color xterms                                *xterm-color* *color-xterm*
2875 Most color xterms have only eight colors.  They should work with these
2876 lines in your .vimrc:
2877 >  :if has("terminfo")
2878 >  :  set t_Co=8
2879 >  :  set t_Sf=<Esc>[3%p1%dm
2880 >  :  set t_Sb=<Esc>[4%p1%dm
2881 >  :else
2882 >  :  set t_Co=8
2883 >  :  set t_Sf=<Esc>[3%dm
2884 >  :  set t_Sb=<Esc>[4%dm
2885 >  :endif
2886         [<Esc> is a real escape, type CTRL-V <Esc>]
2888 You might want to put these lines in an ":if" that checks the name of your
2889 terminal, for example:
2890 >  :if &term =~ "xterm"
2891    put above lines here
2892 >  :endif
2894 Note: Do these settings BEFORE doing ":syntax on".  Otherwise the colors may
2895 be wrong.
2896                                                         *xiterm* *rxvt*
2897 The above settings have been mentioned to work for xiterm and rxvt too.
2899                                                         *colortest.vim*
2900 To test your color setup, a file has been included in the Vim distribution.
2901 To use it, execute these commands:
2902 >  :e $VIMRUNTIME/syntax/colortest.vim
2903 >  :so %
2905 Some versions of xterm (and other terminals, like the linux console) can
2906 output lighter foreground colors, even though the number of colors is defined
2907 at 8.  Therefore Vim sets the "cterm=bold" attribute for light foreground
2908 colors, when 't_Co' is 8.
2910 To get 16 colors, get the newest xterm version (which should be included with
2911 Xfree86 3.3 and later).  You can also find the latest version at:
2912         http://www.clark.net/pub/dickey/xterm
2913 You probably have to enable 16 colors when running configure:
2914         ./configure --disable-bold-color
2915 If you only get 8 colors, check the xterm compilation settings.
2916 (Also see |UTF8-xterm| for using this xterm with UTF-8 character encoding).
2918 This xterm should work with these lines in your .vimrc:
2919 >  :if has("terminfo")
2920 >  :  set t_Co=16
2921 >  :  set t_AB=<Esc>[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm
2922 >  :  set t_AF=<Esc>[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm
2923 >  :else
2924 >  :  set t_Co=16
2925 >  :  set t_Sf=<Esc>[3%dm
2926 >  :  set t_Sb=<Esc>[4%dm
2927 >  :endif
2928         [<Esc> is a real escape, type CTRL-V <Esc>]
2930 Without |+terminfo|, Vim will recognize these settings, and automatically
2931 translate cterm colors of 8 and above to "<Esc>[9%dm" and "<Esc>[10%dm".
2933 Or just set the TERM environment variable to "xterm-16color" and try if that
2934 works.
2936 You probably want to use these X resources (in your ~/.Xdefaults file):
2937         XTerm*color0:                   #000000
2938         XTerm*color1:                   #c00000
2939         XTerm*color2:                   #008000
2940         XTerm*color3:                   #808000
2941         XTerm*color4:                   #0000c0
2942         XTerm*color5:                   #c000c0
2943         XTerm*color6:                   #008080
2944         XTerm*color7:                   #c0c0c0
2945         XTerm*color8:                   #808080
2946         XTerm*color9:                   #ff6060
2947         XTerm*color10:                  #00ff00
2948         XTerm*color11:                  #ffff00
2949         XTerm*color12:                  #8080ff
2950         XTerm*color13:                  #ff40ff
2951         XTerm*color14:                  #00ffff
2952         XTerm*color15:                  #ffffff
2953         Xterm*cursorColor:              Black
2955 [Note: The cursorColor is required to work around a bug, which changes the
2956 cursor color to the color of the last drawn text.  This has been fixed by a
2957 newer version of xterm, but not everybody is it using yet.]
2959 To get these right away, reload the .Xdefaults file to the X Option database
2960 Manager (you only need to do this when you just changed the .Xdefaults file):
2961 >  xrdb -merge ~/.Xdefaults
2963                                                         *xterm-blink*
2964 To make the cursor blink in an xterm, see tools/blink.c.  Or use Thomas
2965 Dickey's xterm above patchlevel 107 (see above for where to get it), with
2966 these resources:
2967         XTerm*cursorBlink:      on
2968         XTerm*cursorOnTime:     400
2969         XTerm*cursorOffTime:    250
2970         XTerm*cursorColor:      White
2972                                                         *hpterm-color*
2973 These settings work (more or less) for a hpterm, which only supports 8
2974 foreground colors:
2975 >  :if has("terminfo")
2976 >  :  set t_Co=8
2977 >  :  set t_Sf=<Esc>[&v%p1%dS
2978 >  :  set t_Sb=<Esc>[&v7S
2979 >  :else
2980 >  :  set t_Co=8
2981 >  :  set t_Sf=<Esc>[&v%dS
2982 >  :  set t_Sb=<Esc>[&v7S
2983 >  :endif
2984         [<Esc> is a real escape, type CTRL-V <Esc>]
2986                                                 *Eterm* *enlightened-terminal*
2987 These settings have been reported to work for the Enlightened terminal
2988 emulator, or Eterm.  They might work for all xterm-like terminals that use the
2989 bold attribute to get bright colors.  Add an ":if" like above when needed.
2990 >      set t_Co=16
2991 >      set t_AF=^[[%?%p1%{8}%<%t3%p1%d%e%p1%{22}%+%d;1%;m
2992 >      set t_AB=^[[%?%p1%{8}%<%t4%p1%d%e%p1%{32}%+%d;1%;m
2994                                                 *TTpro-telnet*
2995 These settings should work for TTpro telnet.  Tera Term Pro is a freeware /
2996 open-source program for MS-Windows.
2997 >       set t_Co=16
2998 >       set t_AB=^[[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{32}%+5;%;%dm
2999 >       set t_AF=^[[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{22}%+1;%;%dm
3000 Also make sure TTpro's Setup / Window / Full Color is enabled, and make sure
3001 that Setup / Font / Enable Bold is NOT enabled.
3002 (info provided by John Love-Jensen <eljay@Adobe.COM>)
3004  vim:tw=78:ts=8:sw=4