diff options
Diffstat (limited to 'runtime/doc/syntax.txt')
-rw-r--r-- | runtime/doc/syntax.txt | 4161 |
1 files changed, 4161 insertions, 0 deletions
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt new file mode 100644 index 0000000000..db322355b0 --- /dev/null +++ b/runtime/doc/syntax.txt @@ -0,0 +1,4161 @@ +*syntax.txt* For Vim version 7.0aa. Last change: 2004 Jun 09 + + + VIM REFERENCE MANUAL by Bram Moolenaar + + +Syntax highlighting *syntax* *syntax-highlighting* *coloring* + +Syntax highlighting enables Vim to show parts of the text in another font or +color. Those parts can be specific keywords or text matching a pattern. Vim +doesn't parse the whole file (to keep it fast), so the highlighting has its +limitations. Lexical highlighting might be a better name, but since everybody +calls it syntax highlighting we'll stick with that. + +Vim supports syntax highlighting on all terminals. But since most ordinary +terminals have very limited highlighting possibilities, it works best in the +GUI version, gvim. + +In the User Manual: +|usr_06.txt| introduces syntax highlighting. +|usr_44.txt| introduces writing a syntax file. + +1. Quick start |:syn-qstart| +2. Syntax files |:syn-files| +3. Syntax loading procedure |syntax-loading| +4. Syntax file remarks |:syn-file-remarks| +5. Defining a syntax |:syn-define| +6. :syntax arguments |:syn-arguments| +7. Syntax patterns |:syn-pattern| +8. Syntax clusters |:syn-cluster| +9. Including syntax files |:syn-include| +10. Synchronizing |:syn-sync| +11. Listing syntax items |:syntax| +12. Highlight command |:highlight| +13. Linking groups |:highlight-link| +14. Cleaning up |:syn-clear| +15. Highlighting tags |tag-highlight| +16. Color xterms |xterm-color| + +{Vi does not have any of these commands} + +Syntax highlighting is not available when the |+syntax| feature has been +disabled at compile time. + +============================================================================== +1. Quick start *:syn-qstart* + + *:syn-enable* *:syntax-enable* +This command switches on syntax highlighting: > + + :syntax enable + +What this command actually does is to execute the command > + :source $VIMRUNTIME/syntax/syntax.vim + +If the VIM environment variable is not set, Vim will try to find +the path in another way (see |$VIMRUNTIME|). Usually this works just +fine. If it doesn't, try setting the VIM environment variable to the +directory where the Vim stuff is located. For example, if your syntax files +are in the "/usr/vim/vim50/syntax" directory, set $VIMRUNTIME to +"/usr/vim/vim50". You must do this in the shell, before starting Vim. + + *:syn-on* *:syntax-on* +The ":syntax enable" command will keep your current color settings. This +allows using ":highlight" commands to set your preferred colors before or +after using this command. If you want Vim to overrule your settings with the +defaults, use: > + :syntax on +< + *:hi-normal* *:highlight-normal* +If you are running in the GUI, you can get white text on a black background +with: > + :highlight Normal guibg=Black guifg=White +For a color terminal see |:hi-normal-cterm|. +For setting up your own colors syntax highlighting see |syncolor|. + +NOTE: The syntax files on MS-DOS and Windows have lines that end in <CR><NL>. +The files for Unix end in <NL>. This means you should use the right type of +file for your system. Although on MS-DOS and Windows the right format is +automatically selected if the 'fileformats' option is not empty. + +NOTE: When using reverse video ("gvim -fg white -bg black"), the default value +of 'background' will not be set until the GUI window is opened, which is after +reading the .gvimrc. This will cause the wrong default highlighting to be +used. To set the default value of 'background' before switching on +highlighting, include the ":gui" command in the .gvimrc: > + + :gui " open window and set default for 'background' + :syntax on " start highlighting, use 'background' to set colors + +NOTE: Using ":gui" in the .gvimrc means that "gvim -f" won't start in the +foreground! Use ":gui -f" then. + + +You can toggle the syntax on/off with this command > + :if exists("syntax_on") | syntax off | else | syntax enable | endif + +To put this into a mapping, you can use: > + :map <F7> :if exists("syntax_on") <Bar> + \ syntax off <Bar> + \ else <Bar> + \ syntax enable <Bar> + \ endif <CR> +[using the |<>| notation, type this literally] + +Details +The ":syntax" commands are implemented by sourcing a file. To see exactly how +this works, look in the file: + command file ~ + :syntax enable $VIMRUNTIME/syntax/syntax.vim + :syntax on $VIMRUNTIME/syntax/syntax.vim + :syntax manual $VIMRUNTIME/syntax/manual.vim + :syntax off $VIMRUNTIME/syntax/nosyntax.vim +Also see |syntax-loading|. + +============================================================================== +2. Syntax files *:syn-files* + +The syntax and highlighting commands for one language are normally stored in +a syntax file. The name convention is: "{name}.vim". Where {name} is the +name of the language, or an abbreviation (to fit the name in 8.3 characters, +a requirement in case the file is used on a DOS filesystem). +Examples: + c.vim perl.vim java.vim html.vim + cpp.vim sh.vim csh.vim + +The syntax file can contain any Ex commands, just like a vimrc file. But +the idea is that only commands for a specific language are included. When a +language is a superset of another language, it may include the other one, +for example, the cpp.vim file could include the c.vim file: > + :so $VIMRUNTIME/syntax/c.vim + +The .vim files are normally loaded with an autocommand. For example: > + :au Syntax c runtime! syntax/c.vim + :au Syntax cpp runtime! syntax/cpp.vim +These commands are normally in the file $VIMRUNTIME/syntax/synload.vim. + + +MAKING YOUR OWN SYNTAX FILES *mysyntaxfile* + +When you create your own syntax files, and you want to have Vim use these +automatically with ":syntax enable", do this: + +1. Create your user runtime directory. You would normally use the first item + of the 'runtimepath' option. Example for Unix: > + mkdir ~/.vim + +2. Create a directory in there called "syntax". For Unix: > + mkdir ~/.vim/syntax + +3. Write the Vim syntax file. Or download one from the internet. Then write + it in your syntax directory. For example, for the "mine" syntax: > + :w ~/.vim/syntax/mine.vim + +Now you can start using your syntax file manually: > + :set syntax=mine +You don't have to exit Vim to use this. + +If you also want Vim to detect the type of file, see |new-filetype|. + +If you are setting up a system with many users and you don't want each user +to add the same syntax file, you can use another directory from 'runtimepath'. + + +ADDING TO AN EXISTING SYNTAX FILE *mysyntaxfile-add* + +If you are mostly satisfied with an existing syntax file, but would like to +add a few items or change the highlighting, follow these steps: + +1. Create your user directory from 'runtimepath', see above. + +2. Create a directory in there called "after/syntax". For Unix: > + mkdir ~/.vim/after + mkdir ~/.vim/after/syntax + +3. Write a Vim script that contains the commands you want to use. For + example, to change the colors for the C syntax: > + highlight cComment ctermfg=Green guifg=Green + +4. Write that file in the "after/syntax" directory. Use the name of the + syntax, with ".vim" added. For our C syntax: > + :w ~/.vim/after/syntax/c.vim + +That's it. The next time you edit a C file the Comment color will be +different. You don't even have to restart Vim. + + +REPLACING AN EXISTING SYNTAX FILE *mysyntaxfile-replace* + +If you don't like a distributed syntax file, or you have downloaded a new +version, follow the same steps as for |mysyntaxfile| above. Just make sure +that you write the syntax file in a directory that is early in 'runtimepath'. +Vim will only load the first syntax file found. + + +NAMING CONVENTIONS + *group-name* *{group-name}* *E669* *W18* +The name for a highlight or syntax group must consist of ASCII letters, digits +and the underscore. As a regexp: "[a-zA-Z0-9_]*" + +To be able to allow each user to pick his favorite set of colors, there must +be preferred names for highlight groups that are common for many languages. +These are the suggested group names (if syntax highlighting works properly +you can see the actual color, except for "Ignore"): + + *Comment any comment + + *Constant any constant + String a string constant: "this is a string" + Character a character constant: 'c', '\n' + Number a number constant: 234, 0xff + Boolean a boolean constant: TRUE, false + Float a floating point constant: 2.3e10 + + *Identifier any variable name + Function function name (also: methods for classes) + + *Statement any statement + Conditional if, then, else, endif, switch, etc. + Repeat for, do, while, etc. + Label case, default, etc. + Operator "sizeof", "+", "*", etc. + Keyword any other keyword + Exception try, catch, throw + + *PreProc generic Preprocessor + Include preprocessor #include + Define preprocessor #define + Macro same as Define + PreCondit preprocessor #if, #else, #endif, etc. + + *Type int, long, char, etc. + StorageClass static, register, volatile, etc. + Structure struct, union, enum, etc. + Typedef A typedef + + *Special any special symbol + SpecialChar special character in a constant + Tag you can use CTRL-] on this + Delimiter character that needs attention + SpecialComment special things inside a comment + Debug debugging statements + + *Underlined text that stands out, HTML links + + *Ignore left blank, hidden + + *Error any erroneous construct + + *Todo anything that needs extra attention; mostly the + keywords TODO FIXME and XXX + +The names marked with * are the preferred groups; the others are minor groups. +For the preferred groups, the "syntax.vim" file contains default highlighting. +The minor groups are linked to the preferred groups, so they get the same +highlighting. You can override these defaults by using ":highlight" commands +after sourcing the "syntax.vim" file. + +Note that highlight group names are not case sensitive. "String" and "string" +can be used for the same group. + +The following names are reserved and cannot be used as a group name: + NONE ALL ALLBUT contains contained + +============================================================================== +3. Syntax loading procedure *syntax-loading* + +This explains the details that happen when the command ":syntax enable" is +issued. When Vim initializes itself, it finds out where the runtime files are +located. This is used here as the variable |$VIMRUNTIME|. + +":syntax enable" and ":syntax on" do the following: + + Source $VIMRUNTIME/syntax/syntax.vim + | + +- Clear out any old syntax by sourcing $VIMRUNTIME/syntax/nosyntax.vim + | + +- Source first syntax/synload.vim in 'runtimepath' + | | + | +- Setup the colors for syntax highlighting. If a color scheme is + | | defined it is loaded again with ":colors {name}". Otherwise + | | ":runtime! syntax/syncolor.vim" is used. ":syntax on" overrules + | | existing colors, ":syntax enable" only sets groups that weren't + | | set yet. + | | + | +- Set up syntax autocmds to load the appropriate syntax file when + | | the 'syntax' option is set. *synload-1* + | | + | +- Source the user's optional file, from the |mysyntaxfile| variable. + | This is for backwards compatibility with Vim 5.x only. *synload-2* + | + +- Do ":filetype on", which does ":runtime! filetype.vim". It loads any + | filetype.vim files found. It should always Source + | $VIMRUNTIME/filetype.vim, which does the following. + | | + | +- Install autocmds based on suffix to set the 'filetype' option + | | This is where the connection between file name and file type is + | | made for known file types. *synload-3* + | | + | +- Source the user's optional file, from the *myfiletypefile* + | | variable. This is for backwards compatibility with Vim 5.x only. + | | *synload-4* + | | + | +- Install one autocommand which sources scripts.vim when no file + | | type was detected yet. *synload-5* + | | + | +- Source $VIMRUNTIME/menu.vim, to setup the Syntax menu. |menu.vim| + | + +- Install a FileType autocommand to set the 'syntax' option when a file + | type has been detected. *synload-6* + | + +- Execute syntax autocommands to start syntax highlighting for each + already loaded buffer. + + +Upon loading a file, Vim finds the relevant syntax file as follows: + + Loading the file triggers the BufReadPost autocommands. + | + +- If there is a match with one of the autocommands from |synload-3| + | (known file types) or |synload-4| (user's file types), the 'filetype' + | option is set to the file type. + | + +- The autocommand at |synload-5| is triggered. If the file type was not + | found yet, then scripts.vim is searched for in 'runtimepath'. This + | should always load $VIMRUNTIME/scripts.vim, which does the following. + | | + | +- Source the user's optional file, from the *myscriptsfile* + | | variable. This is for backwards compatibility with Vim 5.x only. + | | + | +- If the file type is still unknown, check the contents of the file, + | again with checks like "getline(1) =~ pattern" as to whether the + | file type can be recognized, and set 'filetype'. + | + +- When the file type was determined and 'filetype' was set, this + | triggers the FileType autocommand |synload-6| above. It sets + | 'syntax' to the determined file type. + | + +- When the 'syntax' option was set above, this triggers an autocommand + | from |synload-1| (and |synload-2|). This find the main syntax file in + | 'runtimepath', with this command: + | runtime! syntax/<name>.vim + | + +- Any other user installed FileType or Syntax autocommands are + triggered. This can be used to change the highlighting for a specific + syntax. + +============================================================================== +4. Syntax file remarks *:syn-file-remarks* + + *b:current_syntax-variable* +Vim stores the name of the syntax that has been loaded in the +"b:current_syntax" variable. You can use this if you want to load other +settings, depending on which syntax is active. Example: > + :au BufReadPost * if b:current_syntax == "csh" + :au BufReadPost * do-some-things + :au BufReadPost * endif + + +2HTML *2html.vim* *convert-to-HTML* + +This is not a syntax file itself, but a script that converts the current +window into HTML. Vim opens a new window in which it builds the HTML file. + +You are not supposed to set the 'filetype' or 'syntax' option to "2html"! +Source the script to convert the current file: > + + :runtime! syntax/2html.vim +< +Warning: This is slow! + *:TOhtml* +Or use the ":TOhtml" user command. It is defined in a standard plugin. +":TOhtml" also works with a range and in a Visual area: > + + :10,40TOhtml + +After you save the resulting file, you can view it with any HTML viewer, such +as Netscape. The colors should be exactly the same as you see them in Vim. + +To restrict the conversion to a range of lines set "html_start_line" and +"html_end_line" to the first and last line to be converted. Example, using +the last set Visual area: > + + :let html_start_line = line("'<") + :let html_end_line = line("'>") + +The lines are numbered according to 'number' option and the Number +highlighting. You can force lines to be numbered in the HTML output by +setting "html_number_lines" to non-zero value: > + :let html_number_lines = 1 +Force to omit the line numbers by using a zero value: > + :let html_number_lines = 0 +Go back to the default to use 'number' by deleting the variable: > + :unlet html_number_lines + +By default, HTML optimized for old browsers is generated. If you prefer using +cascading style sheets (CSS1) for the attributes (resulting in considerably +shorter and valid HTML 4 file), use: > + :let html_use_css = 1 + +By default "<pre>" and "</pre>" is used around the text. This makes it show +up as you see it in Vim, but without wrapping. If you prefer wrapping, at the +risk of making some things look a bit different, use: > + :let html_no_pre = 1 +This will use <br> at the end of each line and use " " for repeated +spaces. + +The current value of 'encoding' is used to specify the charset of the HTML +file. This only works for those values of 'encoding' that have an equivalent +HTML charset name. To overrule this set g:html_use_encoding to the name of +the charset to be used: > + :let html_use_encoding = "foobar" +To omit the line that specifies the charset, set g:html_use_encoding to an +empty string: > + :let html_use_encoding = "" +To go back to the automatic mechanism, delete the g:html_use_encoding +variable: > + :unlet html_use_encoding +< + *convert-to-XML* *convert-to-XHTML* +An alternative is to have the script generate XHTML (XML compliant HTML). To +do this set the "use_xhtml" variable: > + :let use_xhtml = 1 +To disable it again delete the variable: > + :unlet use_xhtml +The generated XHTML file can be used in DocBook XML documents. See: + http://people.mech.kuleuven.ac.be/~pissaris/howto/src2db.html + +Remarks: +- This only works in a version with GUI support. If the GUI is not actually + running (possible for X11) it still works, but not very well (the colors + may be wrong). +- Older browsers will not show the background colors. +- From most browsers you can also print the file (in color)! + +Here is an example how to run the script over all .c and .h files from a +Unix shell: > + for f in *.[ch]; do gvim -f +"syn on" +"run! syntax/2html.vim" +"wq" +"q" $f; done +< + +ABEL *abel.vim* *abel-syntax* + +ABEL highlighting provides some user-defined options. To enable them, assign +any value to the respective variable. Example: > + :let abel_obsolete_ok=1 +To disable them use ":unlet". Example: > + :unlet abel_obsolete_ok + +Variable Highlight ~ +abel_obsolete_ok obsolete keywords are statements, not errors +abel_cpp_comments_illegal do not interpret '//' as inline comment leader + + +ADA *ada.vim* *ada-syntax* + +This mode is designed for the 1995 edition of Ada ("Ada95"), which +includes support for objected-programming, protected types, and so on. +It handles code written for the original Ada language +("Ada83" or "Ada87") as well, though Ada83 code which uses Ada95-only +keywords will be wrongly colored (such code should be fixed anyway). +For more information about Ada, see http://www.adapower.com. + +The Ada mode handles a number of situations cleanly. +For example, it knows that the "-" in "-5" is a number, but the same +character in "A-5" is an operator. Normally, a "with" or "use" clause +referencing another compilation unit is colored the same way as C's +"#include" is colored. If you have "Conditional" or "Repeat" +groups colored differently, then "end if" and "end loop" will be +colored as part of those respective groups. +You can set these to different colors using vim's "highlight" command +(e.g., to change how loops are displayed, enter the command +":hi Repeat" followed by the color specification; on simple terminals +the color specification ctermfg=White often shows well). + +There are several options you can select in this Ada mode. +To enable them, assign a value to the option. For example, to turn one on: + let ada_standard_types = 1 +To disable them use ":unlet". Example: + unlet ada_standard_types = 1 +You can just use ":" and type these into the command line to set these +temporarily before loading an Ada file. You can make these option settings +permanent by adding the "let" command(s), without a colon, +to your "~/.vimrc" file. + +Here are the Ada mode options: + +Variable Action ~ +ada_standard_types Highlight types in package Standard (e.g., "Float") +ada_space_errors Highlight extraneous errors in spaces... +ada_no_trail_space_error but ignore trailing spaces at the end of a line +ada_no_tab_space_error but ignore tabs after spaces +ada_withuse_ordinary Show "with" and "use" as ordinary keywords + (when used to reference other compilation units + they're normally highlighted specially). +ada_begin_preproc Show all begin-like keywords using the coloring + of C preprocessor commands. + +Even on a slow (90Mhz) PC this mode works quickly, but if you find +the performance unacceptable, turn on ada_withuse_ordinary. + + +ANT *ant.vim* *ant-syntax* + +The ant syntax file provides syntax highlighting for javascript and python +by default. Syntax highlighting for other script languages can be installed +by the function AntSyntaxScript(), which takes the tag name as first argument +and the script syntax file name as second argument. Example: > + + :call AntSyntaxScript('perl', 'perl.vim') + +will install syntax perl highlighting for the following ant code > + + <script language = 'perl'><![CDATA[ + # everything inside is highlighted as perl + ]]></script> + +See |mysyntaxfile-add| for installing script languages permanently. + + +APACHE *apache.vim* *apache-syntax* + +The apache syntax file provides syntax highlighting depending on Apache HTTP +server version, by default for 1.3.x. Set "apache_version" to Apache version +(as a string) to get highlighting for another version. Example: > + + :let apache_version = "2.0" +< + + *asm.vim* *asmh8300.vim* *nasm.vim* *masm.vim* *asm68k* +ASSEMBLY *asm-syntax* *asmh8300-syntax* *nasm-syntax* *masm-syntax* + *asm68k-syntax* *fasm.vim* + +Files matching "*.i" could be Progress or Assembly. If the automatic detection +doesn't work for you, or you don't edit Progress at all, use this in your +startup vimrc: > + :let filetype_i = "asm" +Replace "asm" with the type of assembly you use. + +There are many types of assembly languages that all use the same file name +extensions. Therefore you will have to select the type yourself, or add a +line in the assembly file that Vim will recognize. Currently these syntax +files are included: + asm GNU assembly (the default) + asm68k Motorola 680x0 assembly + asmh8300 Hitachi H-8300 version of GNU assembly + ia64 Intel Itanium 64 + fasm Flat assembly (http://flatassembler.net) + masm Microsoft assembly (probably works for any 80x86) + nasm Netwide assembly + tasm Turbo Assembly (with opcodes 80x86 up to Pentium, and + MMX) + pic PIC assembly (currently for PIC16F84) + +The most flexible is to add a line in your assembly file containing: > + :asmsyntax=nasm +Replace "nasm" with the name of the real assembly syntax. This line must be +one of the first five lines in the file. + +The syntax type can always be overruled for a specific buffer by setting the +b:asmsyntax variable: > + :let b:asmsyntax=nasm + +If b:asmsyntax is not set, either automatically or by hand, then the value of +the global variable asmsyntax is used. This can be seen as a default assembly +language: > + :let asmsyntax=nasm + +As a last resort, if nothing is defined, the "asm" syntax is used. + + +Netwide assembler (nasm.vim) optional highlighting ~ + +To enable a feature: > + :let {variable}=1|set syntax=nasm +To disable a feature: > + :unlet {variable} |set syntax=nasm + +Variable Highlight ~ +nasm_loose_syntax unofficial parser allowed syntax not as Error + (parser dependent; not recommended) +nasm_ctx_outside_macro contexts outside macro not as Error +nasm_no_warn potentially risky syntax not as ToDo + + +ASPPERL and ASPVBS *aspperl-syntax* *aspvbs-syntax* + +*.asp and *.asa files could be either Perl or Visual Basic script. Since it's +hard to detect this you can set two global variables to tell Vim what you are +using. For Perl script use: > + :let g:filetype_asa = "aspperl" + :let g:filetype_asp = "aspperl" +For Visual Basic use: > + :let g:filetype_asa = "aspvbs" + :let g:filetype_asp = "aspvbs" + + +BASIC *basic.vim* *vb.vim* *basic-syntax* *vb-syntax* + +Both Visual Basic and "normal" basic use the extension ".bas". To detect +which one should be used, Vim checks for the string "VB_Name" in the first +five lines of the file. If it is not found, filetype will be "basic", +otherwise "vb". Files with the ".frm" extension will always be seen as Visual +Basic. + + +C *c.vim* *c-syntax* + +A few things in C highlighting are optional. To enable them assign any value +to the respective variable. Example: > + :let c_comment_strings=1 +To disable them use ":unlet". Example: > + :unlet c_comment_strings + +Variable Highlight ~ +c_gnu GNU gcc specific items +c_comment_strings strings and numbers inside a comment +c_space_errors trailing white space and spaces before a <Tab> +c_no_trail_space_error ... but no trailing spaces +c_no_tab_space_error ... but no spaces before a <Tab> +c_no_bracket_error don't highlight {}; inside [] as errors +c_no_ansi don't do standard ANSI types and constants +c_ansi_typedefs ... but do standard ANSI types +c_ansi_constants ... but do standard ANSI constants +c_no_utf don't highlight \u and \U in strings +c_syntax_for_h use C syntax for *.h files, instead of C++ +c_no_if0 don't highlight "#if 0" blocks as comments +c_no_cformat don't highlight %-formats in strings +c_no_c99 don't highlight C99 standard items + +If you notice highlighting errors while scrolling backwards, which are fixed +when redrawing with CTRL-L, try setting the "c_minlines" internal variable +to a larger number: > + :let c_minlines = 100 +This will make the syntax synchronization start 100 lines before the first +displayed line. The default value is 50 (15 when c_no_if0 is set). The +disadvantage of using a larger number is that redrawing can become slow. + +When using the "#if 0" / "#endif" comment highlighting, notice that this only +works when the "#if 0" is within "c_minlines" from the top of the window. If +you have a long "#if 0" construct it will not be highlighted correctly. + +To match extra items in comments, use the cCommentGroup cluster. +Example: > + :au Syntax c call MyCadd() + :function MyCadd() + : syn keyword cMyItem contained Ni + : syn cluster cCommentGroup add=cMyItem + : hi link cMyItem Title + :endfun + +ANSI constants will be highlighted with the "cConstant" group. This includes +"NULL", "SIG_IGN" and others. But not "TRUE", for example, because this is +not in the ANSI standard. If you find this confusing, remove the cConstant +highlighting: > + :hi link cConstant NONE + +If you see '{' and '}' highlighted as an error where they are OK, reset the +highlighting for cErrInParen and cErrInBracket. + +If you want to use folding in your C files, you can add these lines in a file +an the "after" directory in 'runtimepath'. For Unix this would be +~/.vim/after/syntax/c.vim. > + syn region myFold start="{" end="}" transparent fold + syn sync fromstart + set foldmethod=syntax + + +CHILL *chill.vim* *chill-syntax* + +Chill syntax highlighting is similar to C. See |c.vim| for all the settings +that are available. Additionally there is: + +chill_syntax_for_h use Ch syntax for *.h files, instead of C or C++ +chill_space_errors like c_space_errors +chill_comment_string like c_comment_strings +chill_minlines like c_minlines + + +CHANGELOG *changelog.vim* *changelog-syntax* + +ChangeLog supports highlighting spaces at the start of a line. +If you do not like this, add following line to your .vimrc: > + let g:changelog_spacing_errors = 0 +This works the next time you edit a changelog file. You can also use +"b:changelog_spacing_errors" to set this per buffer (before loading the syntax +file). + +You can change the highlighting used, e.g., to flag the spaces as an error: > + :hi link ChangelogError Error +Or to avoid the highlighting: > + :hi link ChangelogError NONE +This works immediately. + + +COBOL *cobol.vim* *cobol-syntax* + +COBOL highlighting has different needs for legacy code than it does for fresh +development. This is due to differences in what is being done (maintenance +versus development) and other factors. To enable legacy code highlighting, +add this line to your .vimrc: > + :let cobol_legacy_code = 1 +To disable it again, use this: > + :unlet cobol_legacy_code + + +COLD FUSION *coldfusion.vim* *coldfusion-syntax* + +The ColdFusion has its own version of HTML comments. To turn on ColdFusion +comment highlighting, add the following line to your startup file: > + + :let html_wrong_comments = 1 + +The ColdFusion syntax file is based on the HTML syntax file. + + +CSH *csh.vim* *csh-syntax* + +This covers the shell named "csh". Note that on some systems tcsh is actually +used. + +Detecting whether a file is csh or tcsh is notoriously hard. Some systems +symlink /bin/csh to /bin/tcsh, making it almost impossible to distinguish +between csh and tcsh. In case VIM guesses wrong you can set the +"filetype_csh" variable. For using csh: > + + :let filetype_csh = "csh" + +For using tcsh: > + + :let filetype_csh = "tcsh" + +Any script with a tcsh extension or a standard tcsh filename (.tcshrc, +tcsh.tcshrc, tcsh.login) will have filetype tcsh. All other tcsh/csh scripts +will be classified as tcsh, UNLESS the "filetype_csh" variable exists. If the +"filetype_csh" variable exists, the filetype will be set to the value of the +variable. + + +CYNLIB *cynlib.vim* *cynlib-syntax* + +Cynlib files are C++ files that use the Cynlib class library to enable +hardware modeling and simulation using C++. Typically Cynlib files have a .cc +or a .cpp extension, which makes it very difficult to distinguish them from a +normal C++ file. Thus, to enable Cynlib highlighting for .cc files, add this +line to your .vimrc file: > + + :let cynlib_cyntax_for_cc=1 + +Similarly for cpp files (this extension is only usually used in Windows) > + + :let cynlib_cyntax_for_cpp=1 + +To disable these again, use this: > + + :unlet cynlib_cyntax_for_cc + :unlet cynlib_cyntax_for_cpp +< + +CWEB *cweb.vim* *cweb-syntax* + +Files matching "*.w" could be Progress or cweb. If the automatic detection +doesn't work for you, or you don't edit Progress at all, use this in your +startup vimrc: > + :let filetype_w = "cweb" + + +DESKTOP *desktop.vim* *desktop-syntax* + +Primary goal of this syntax file is to highlight .desktop and .directory files +according to freedesktop.org standard: http://pdx.freedesktop.org/Standards/ +But actually almost none implements this standard fully. Thus it will +highlight all Unix ini files. But you can force strict highlighting according +to standard by placing this in your vimrc file: > + :let enforce_freedesktop_standard = 1 + + +DIRCOLORS *dircolors.vim* *dircolors-syntax* + +The dircolors utility highlighting definition has one option. It exists to +provide compatibility with the Slackware GNU/Linux distributions version of +the command. It adds a few keywords that are generally ignored by most +versions. On Slackware systems, however, the utility accepts the keywords and +uses them for processing. To enable the Slackware keywords add the following +line to your startup file: > + let dircolors_is_slackware = 1 + + +DOCBOOK *docbk.vim* *docbk-syntax* *docbook* +DOCBOOK XML *docbkxml.vim* *docbkxml-syntax* +DOCBOOK SGML *docbksgml.vim* *docbksgml-syntax* + +There are two types of DocBook files: SGML and XML. To specify what type you +are using the "b:docbk_type" variable should be set. Vim does this for you +automatically if it can recognize the type. When Vim can't guess it the type +defaults to XML. +You can set the type manually: > + :let docbk_type = "sgml" +or: > + :let docbk_type = "xml" +You need to do this before loading the syntax file, which is complicated. +Simpler is setting the filetype to "docbkxml" or "docbksgml": > + :set filetype=docbksgml +or: > + :set filetype=docbkxml + + +DOSBATCH *dosbatch.vim* *dosbatch-syntax* + +There is one option with highlighting DOS batch files. This covers new +extensions to the Command Interpreter introduced with Windows 2000 and +is controlled by the variable dosbatch_cmdextversion. For Windows NT +this should have the value 1, and for Windows 2000 it should be 2. +Select the version you want with the following line: > + + :let dosbatch_cmdextversion = 1 + +If this variable is not defined it defaults to a value of 2 to support +Windows 2000. + + +DTD *dtd.vim* *dtd-syntax* + +The DTD syntax highlighting is case sensitive by default. To disable +case-sensitive highlighting, add the following line to your startup file: > + + :let dtd_ignore_case=1 + +The DTD syntax file will highlight unknown tags as errors. If +this is annoying, it can be turned off by setting: > + + :let dtd_no_tag_errors=1 + +before sourcing the dtd.vim syntax file. +Parameter entity names are highlighted in the definition using the +'Type' highlighting group and 'Comment' for punctuation and '%'. +Parameter entity instances are highlighted using the 'Constant' +highlighting group and the 'Type' highlighting group for the +delimiters % and ;. This can be turned off by setting: > + + :let dtd_no_param_entities=1 + +The DTD syntax file is also included by xml.vim to highlight included dtd's. + + +EIFFEL *eiffel.vim* *eiffel-syntax* + +While Eiffel is not case-sensitive, its style guidelines are, and the +syntax highlighting file encourages their use. This also allows to +highlight class names differently. If you want to disable case-sensitive +highlighting, add the following line to your startup file: > + + :let eiffel_ignore_case=1 + +Case still matters for class names and TODO marks in comments. + +Conversely, for even stricter checks, add one of the following lines: > + + :let eiffel_strict=1 + :let eiffel_pedantic=1 + +Setting eiffel_strict will only catch improper capitalization for the +five predefined words "Current", "Void", "Result", "Precursor", and +"NONE", to warn against their accidental use as feature or class names. + +Setting eiffel_pedantic will enforce adherence to the Eiffel style +guidelines fairly rigorously (like arbitrary mixes of upper- and +lowercase letters as well as outdated ways to capitalize keywords). + +If you want to use the lower-case version of "Current", "Void", +"Result", and "Precursor", you can use > + + :let eiffel_lower_case_predef=1 + +instead of completely turning case-sensitive highlighting off. + +Support for ISE's proposed new creation syntax that is already +experimentally handled by some compilers can be enabled by: > + + :let eiffel_ise=1 + +Finally, some vendors support hexadecimal constants. To handle them, add > + + :let eiffel_hex_constants=1 + +to your startup file. + + +ERLANG *erlang.vim* *erlang-syntax* + +The erlang highlighting supports Erlang (ERicsson LANGuage). +Erlang is case sensitive and default extension is ".erl". + +If you want to disable keywords highlighting, put in your .vimrc: > + :let erlang_keywords = 1 +If you want to disable built-in-functions highlighting, put in your +.vimrc file: > + :let erlang_functions = 1 +If you want to disable special characters highlighting, put in +your .vimrc: > + :let erlang_characters = 1 + + +FORM *form.vim* *form-syntax* + +The coloring scheme for syntax elements in the FORM file uses the default +modes Conditional, Number, Statement, Comment, PreProc, Type, and String, +following the language specifications in 'Symbolic Manipulation with FORM'' by +J.A.M. Vermaseren, CAN, Netherlands, 1991. + +If you want include your own changes to the default colors, you have to +redefine the following syntax groups: + + - formConditional + - formNumber + - formStatement + - formHeaderStatement + - formComment + - formPreProc + - formDirective + - formType + - formString + +Note that the form.vim syntax file implements FORM preprocessor commands and +directives per default in the same syntax group. + +A predefined enhanced color mode for FORM is available to distinguish between +header statements and statements in the body of a FORM program. To activate +this mode define the following variable in your vimrc file > + + :let form_enhanced_color=1 + +The enhanced mode also takes advantage of additional color features for a dark +gvim display. Here, statements are colored LightYellow instead of Yellow, and +conditionals are LightBlue for better distinction. + + +FORTRAN *fortran.vim* *fortran-syntax* + +Default highlighting and dialect ~ +Highlighting appropriate for f95 (Fortran 95) is used by default. This choice +should be appropriate for most users most of the time because Fortran 95 is a +superset of Fortran 90 and almost a superset of Fortran 77. + +Fortran source code form ~ +Fortran 9x code can be in either fixed or free source form. Note that the +syntax highlighting will not be correct if the form is incorrectly set. + +When you create a new fortran file, the syntax script assumes fixed source +form. If you always use free source form, then > + :let fortran_free_source=1 +in your .vimrc prior to the :syntax on command. If you always use fixed source +form, then > + :let fortran_fixed_source=1 +in your .vimrc prior to the :syntax on command. + +If the form of the source code depends upon the file extension, then it is +most convenient to set fortran_free_source in a ftplugin file. For more +information on ftplugin files, see |ftplugin|. For example, if all your +fortran files with an .f90 extension are written in free source form and the +rest in fixed source form, add the following code to your ftplugin file > + let s:extfname = expand("%:e") + if s:extfname ==? "f90" + let fortran_free_source=1 + unlet! fortran_fixed_source + else + let fortran_fixed_source=1 + unlet! fortran_free_source + endif +Note that this will work only if the "filetype plugin indent on" command +precedes the "syntax on" command in your .vimrc file. + +When you edit an existing |