代码拉取完成,页面将自动刷新
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>syntax - Vim Documentation</title>
<meta name="Generator" content="Vim/8.0">
<meta name="plugin-version" content="vim8.0">
<meta name="syntax" content="help">
<meta name="settings" content="no_pre,use_css,expand_tabs">
<link rel="stylesheet" href="style.css" type="text/css" />
<script src="jquery.min.js" type="text/javascript"></script>
<script src="mark-current-page.js" type="text/javascript"></script>
</head>
<body>
<header>
<div class="header">
<a href="http://vim-jp.org/">vim-jp</a>
/ <a href="http://vim-jp.org/vimdoc-en/">vimdoc-en</a>
/ syntax<br />
<a name="top"></a><h1>syntax - Vim Documentation</h1>
<a href="index.html">Return to main</a>
<span class="EnglishJapaneseLink">
<span class="CurrentLanguage">English</span>
</span>
</div>
</header>
<nav>
<dl>
<dt>BASIC</dt>
<dd><ul>
<li><a href="quickref.html">quickref</a></li>
<li><a href="sponsor.html">sponsor</a></li>
</ul></dd>
<dt>USER MANUAL</dt>
<dd><ul>
<li><a href="usr_toc.html">usr_toc</a></li>
</ul></dd>
<dt>Getting Started</dt>
<dd><ul>
<li><a href="usr_01.html">usr_01</a></li>
<li><a href="usr_02.html">usr_02</a></li>
<li><a href="usr_03.html">usr_03</a></li>
<li><a href="usr_04.html">usr_04</a></li>
<li><a href="usr_05.html">usr_05</a></li>
<li><a href="usr_06.html">usr_06</a></li>
<li><a href="usr_07.html">usr_07</a></li>
<li><a href="usr_08.html">usr_08</a></li>
<li><a href="usr_09.html">usr_09</a></li>
<li><a href="usr_10.html">usr_10</a></li>
<li><a href="usr_11.html">usr_11</a></li>
<li><a href="usr_12.html">usr_12</a></li>
</ul></dd>
<dt>Editing Effectively</dt>
<dd><ul>
<li><a href="usr_20.html">usr_20</a></li>
<li><a href="usr_21.html">usr_21</a></li>
<li><a href="usr_22.html">usr_22</a></li>
<li><a href="usr_23.html">usr_23</a></li>
<li><a href="usr_24.html">usr_24</a></li>
<li><a href="usr_25.html">usr_25</a></li>
<li><a href="usr_26.html">usr_26</a></li>
<li><a href="usr_27.html">usr_27</a></li>
<li><a href="usr_28.html">usr_28</a></li>
<li><a href="usr_29.html">usr_29</a></li>
<li><a href="usr_30.html">usr_30</a></li>
<li><a href="usr_31.html">usr_31</a></li>
<li><a href="usr_32.html">usr_32</a></li>
</ul></dd>
<dt>Tuning Vim</dt>
<dd><ul>
<li><a href="usr_40.html">usr_40</a></li>
<li><a href="usr_41.html">usr_41</a></li>
<li><a href="usr_42.html">usr_42</a></li>
<li><a href="usr_43.html">usr_43</a></li>
<li><a href="usr_44.html">usr_44</a></li>
<li><a href="usr_45.html">usr_45</a></li>
</ul></dd>
<dt>Making Vim Run</dt>
<dd><ul>
<li><a href="usr_90.html">usr_90</a></li>
</ul></dd>
<dt>General subjects</dt>
<dd><ul>
<li><a href="intro.html">intro</a></li>
<li><a href="index.html">help</a></li>
<li><a href="helphelp.html">helphelp</a></li>
<li><a href="vimindex.html">index</a></li>
<li><a href="tags.html">tags</a></li>
<li><a href="howto.html">howto</a></li>
<li><a href="tips.html">tips</a></li>
<li><a href="message.html">message</a></li>
<li><a href="quotes.html">quotes</a></li>
<li><a href="todo.html">todo</a></li>
<li><a href="debug.html">debug</a></li>
<li><a href="develop.html">develop</a></li>
<li><a href="uganda.html">uganda</a></li>
</ul></dd>
<dt>Basic editing</dt>
<dd><ul>
<li><a href="starting.html">starting</a></li>
<li><a href="editing.html">editing</a></li>
<li><a href="motion.html">motion</a></li>
<li><a href="scroll.html">scroll</a></li>
<li><a href="insert.html">insert</a></li>
<li><a href="change.html">change</a></li>
<li><a href="indent.html">indent</a></li>
<li><a href="undo.html">undo</a></li>
<li><a href="repeat.html">repeat</a></li>
<li><a href="visual.html">visual</a></li>
<li><a href="various.html">various</a></li>
<li><a href="recover.html">recover</a></li>
</ul></dd>
<dt>Advanced editing</dt>
<dd><ul>
<li><a href="cmdline.html">cmdline</a></li>
<li><a href="options.html">options</a></li>
<li><a href="pattern.html">pattern</a></li>
<li><a href="map.html">map</a></li>
<li><a href="tagsrch.html">tagsrch</a></li>
<li><a href="quickfix.html">quickfix</a></li>
<li><a href="windows.html">windows</a></li>
<li><a href="tabpage.html">tabpage</a></li>
<li><a href="syntax.html">syntax</a></li>
<li><a href="spell.html">spell</a></li>
<li><a href="diff.html">diff</a></li>
<li><a href="autocmd.html">autocmd</a></li>
<li><a href="filetype.html">filetype</a></li>
<li><a href="eval.html">eval</a></li>
<li><a href="channel.html">channel</a></li>
<li><a href="fold.html">fold</a></li>
</ul></dd>
<dt>Special issues</dt>
<dd><ul>
<li><a href="print.html">print</a></li>
<li><a href="remote.html">remote</a></li>
<li><a href="term.html">term</a></li>
<li><a href="digraph.html">digraph</a></li>
<li><a href="mbyte.html">mbyte</a></li>
<li><a href="mlang.html">mlang</a></li>
<li><a href="arabic.html">arabic</a></li>
<li><a href="farsi.html">farsi</a></li>
<li><a href="hebrew.html">hebrew</a></li>
<li><a href="russian.html">russian</a></li>
<li><a href="ft_ada.html">ft_ada</a></li>
<li><a href="ft_sql.html">ft_sql</a></li>
<li><a href="hangulin.html">hangulin</a></li>
<li><a href="rileft.html">rileft</a></li>
</ul></dd>
<dt>GUI</dt>
<dd><ul>
<li><a href="gui.html">gui</a></li>
<li><a href="gui_w32.html">gui_w32</a></li>
<li><a href="gui_x11.html">gui_x11</a></li>
</ul></dd>
<dt>Interfaces</dt>
<dd><ul>
<li><a href="if_cscop.html">if_cscop</a></li>
<li><a href="if_lua.html">if_lua</a></li>
<li><a href="if_mzsch.html">if_mzsch</a></li>
<li><a href="if_perl.html">if_perl</a></li>
<li><a href="if_pyth.html">if_pyth</a></li>
<li><a href="if_tcl.html">if_tcl</a></li>
<li><a href="if_ole.html">if_ole</a></li>
<li><a href="if_ruby.html">if_ruby</a></li>
<li><a href="debugger.html">debugger</a></li>
<li><a href="workshop.html">workshop</a></li>
<li><a href="netbeans.html">netbeans</a></li>
<li><a href="sign.html">sign</a></li>
</ul></dd>
<dt>Versions</dt>
<dd><ul>
<li><a href="vi_diff.html">vi_diff</a></li>
<li><a href="version4.html">version4</a></li>
<li><a href="version5.html">version5</a></li>
<li><a href="version6.html">version6</a></li>
<li><a href="version7.html">version7</a></li>
<li><a href="version8.html">version8</a></li>
</ul></dd>
<dt>Remarks about specific systems</dt>
<dd><ul>
<li><a href="os_390.html">os_390</a></li>
<li><a href="os_amiga.html">os_amiga</a></li>
<li><a href="os_beos.html">os_beos</a></li>
<li><a href="os_dos.html">os_dos</a></li>
<li><a href="os_mac.html">os_mac</a></li>
<li><a href="os_mint.html">os_mint</a></li>
<li><a href="os_msdos.html">os_msdos</a></li>
<li><a href="os_os2.html">os_os2</a></li>
<li><a href="os_qnx.html">os_qnx</a></li>
<li><a href="os_risc.html">os_risc</a></li>
<li><a href="os_unix.html">os_unix</a></li>
<li><a href="os_vms.html">os_vms</a></li>
<li><a href="os_win32.html">os_win32</a></li>
</ul></dd>
<dt>Standard plugins</dt>
<dd><ul>
<li><a href="pi_getscript.html">pi_getscript</a></li>
<li><a href="pi_gzip.html">pi_gzip</a></li>
<li><a href="pi_logipat.html">pi_logipat</a></li>
<li><a href="pi_netrw.html">pi_netrw</a></li>
<li><a href="pi_paren.html">pi_paren</a></li>
<li><a href="pi_tar.html">pi_tar</a></li>
<li><a href="pi_vimball.html">pi_vimball</a></li>
<li><a href="pi_zip.html">pi_zip</a></li>
</ul></dd>
<dt>Filetype plugins</dt>
<dd><ul>
<li><a href="pi_spec.html">pi_spec</a></li>
</ul></dd>
<dt>Others</dt>
<dd><ul>
<li><a href="vim_faq.html">vim_faq</a></li>
</ul></dd>
</dl>
</nav>
<article class="Vimdoc VimdocJa">
<div id='vimCodeElement'>
<a class="Constant" href="syntax.html" name="syntax.txt">syntax.txt</a> For <span class="Identifier">Vim version 8.0.</span> Last change: 2017 Jul 14<br>
<br>
<br>
<span class="Identifier">VIM REFERENCE MANUAL by Bram Moolenaar</span><br>
<br>
<br>
Syntax highlighting <a class="Constant" href="syntax.html#syntax" name="syntax">syntax</a> <a class="Constant" href="syntax.html#syntax-highlighting" name="syntax-highlighting">syntax-highlighting</a> <a class="Constant" href="syntax.html#coloring" name="coloring">coloring</a><br>
<br>
Syntax highlighting enables Vim to show parts of the text in another font or<br>
color. Those parts can be specific keywords or text matching a pattern. Vim<br>
doesn't parse the whole file (to keep it fast), so the highlighting has its<br>
limitations. Lexical highlighting might be a better name, but since everybody<br>
calls it syntax highlighting we'll stick with that.<br>
<br>
Vim supports syntax highlighting on all terminals. But since most ordinary<br>
terminals have very limited highlighting possibilities, it works best in the<br>
GUI version, gvim.<br>
<br>
In the User Manual:<br>
<a class="Identifier" href="usr_06.html">usr_06.txt</a> introduces syntax highlighting.<br>
<a class="Identifier" href="usr_44.html">usr_44.txt</a> introduces writing a syntax file.<br>
<br>
1. Quick start <a class="Identifier" href="syntax.html#:syn-qstart">:syn-qstart</a><br>
2. Syntax files <a class="Identifier" href="syntax.html#:syn-files">:syn-files</a><br>
3. Syntax loading procedure <a class="Identifier" href="syntax.html#syntax-loading">syntax-loading</a><br>
4. Syntax file remarks <a class="Identifier" href="syntax.html#:syn-file-remarks">:syn-file-remarks</a><br>
5. Defining a syntax <a class="Identifier" href="syntax.html#:syn-define">:syn-define</a><br>
6. :syntax arguments <a class="Identifier" href="syntax.html#:syn-arguments">:syn-arguments</a><br>
7. Syntax patterns <a class="Identifier" href="syntax.html#:syn-pattern">:syn-pattern</a><br>
8. Syntax clusters <a class="Identifier" href="syntax.html#:syn-cluster">:syn-cluster</a><br>
9. Including syntax files <a class="Identifier" href="syntax.html#:syn-include">:syn-include</a><br>
10. Synchronizing <a class="Identifier" href="syntax.html#:syn-sync">:syn-sync</a><br>
11. Listing syntax items <a class="Identifier" href="syntax.html#:syntax">:syntax</a><br>
12. Highlight command <a class="Identifier" href="syntax.html#:highlight">:highlight</a><br>
13. Linking groups <a class="Identifier" href="syntax.html#:highlight-link">:highlight-link</a><br>
14. Cleaning up <a class="Identifier" href="syntax.html#:syn-clear">:syn-clear</a><br>
15. Highlighting tags <a class="Identifier" href="syntax.html#tag-highlight">tag-highlight</a><br>
16. Window-local syntax <a class="Identifier" href="syntax.html#:ownsyntax">:ownsyntax</a><br>
17. Color xterms <a class="Identifier" href="syntax.html#xterm-color">xterm-color</a><br>
18. When syntax is slow <a class="Identifier" href="syntax.html#:syntime">:syntime</a><br>
<br>
<span class="Special">{Vi does not have any of these commands}</span><br>
<br>
Syntax highlighting is not available when the <a class="Identifier" href="various.html#+syntax">+syntax</a> feature has been<br>
disabled at compile time.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
1. Quick start <a class="Constant" href="syntax.html#:syn-qstart" name=":syn-qstart">:syn-qstart</a><br>
<br>
<a class="Constant" href="syntax.html#:syn-enable" name=":syn-enable">:syn-enable</a> <a class="Constant" href="syntax.html#:syntax-enable" name=":syntax-enable">:syntax-enable</a><br>
This command switches on syntax highlighting:<br>
<br>
<div class="helpExample"> :syntax enable</div>
<br>
What this command actually does is to execute the command<br>
<div class="helpExample"> :source $VIMRUNTIME/syntax/syntax.vim</div>
<br>
If the VIM environment variable is not set, Vim will try to find<br>
the path in another way (see <a class="Identifier" href="starting.html#$VIMRUNTIME">$VIMRUNTIME</a>). Usually this works just<br>
fine. If it doesn't, try setting the VIM environment variable to the<br>
directory where the Vim stuff is located. For example, if your syntax files<br>
are in the "/usr/vim/vim50/syntax" directory, set $VIMRUNTIME to<br>
"/usr/vim/vim50". You must do this in the shell, before starting Vim.<br>
<br>
<a class="Constant" href="syntax.html#:syn-on" name=":syn-on">:syn-on</a> <a class="Constant" href="syntax.html#:syntax-on" name=":syntax-on">:syntax-on</a><br>
The ":syntax enable" command will keep your current color settings. This<br>
allows using ":highlight" commands to set your preferred colors before or<br>
after using this command. If you want Vim to overrule your settings with the<br>
defaults, use:<br>
<div class="helpExample"> :syntax on</div>
<br>
<a class="Constant" href="syntax.html#:hi-normal" name=":hi-normal">:hi-normal</a> <a class="Constant" href="syntax.html#:highlight-normal" name=":highlight-normal">:highlight-normal</a><br>
If you are running in the GUI, you can get white text on a black background<br>
with:<br>
<div class="helpExample"> :highlight Normal guibg=Black guifg=White</div>
For a color terminal see <a class="Identifier" href="syntax.html#:hi-normal-cterm">:hi-normal-cterm</a>.<br>
For setting up your own colors syntax highlighting see <a class="Identifier" href="syntax.html#syncolor">syncolor</a>.<br>
<br>
<span class="Todo">NOTE</span>: The syntax files on MS-DOS and Windows have lines that end in <span class="Special"><CR><NL></span>.<br>
The files for Unix end in <span class="Special"><NL></span>. This means you should use the right type of<br>
file for your system. Although on MS-DOS and Windows the right format is<br>
automatically selected if the <a class="Type" href="options.html#'fileformats'">'fileformats'</a> option is not empty.<br>
<br>
<span class="Todo">NOTE</span>: When using reverse video ("gvim -fg white -bg black"), the default value<br>
of <a class="Type" href="options.html#'background'">'background'</a> will not be set until the GUI window is opened, which is after<br>
reading the <a class="Identifier" href="gui.html#gvimrc">gvimrc</a>. This will cause the wrong default highlighting to be<br>
used. To set the default value of <a class="Type" href="options.html#'background'">'background'</a> before switching on<br>
highlighting, include the ":gui" command in the <a class="Identifier" href="gui.html#gvimrc">gvimrc</a>:<br>
<br>
<div class="helpExample"> :gui " open window and set default for 'background'<br>
:syntax on " start highlighting, use 'background' to set colors</div>
<br>
<span class="Todo">NOTE</span>: Using ":gui" in the <a class="Identifier" href="gui.html#gvimrc">gvimrc</a> means that "gvim -f" won't start in the<br>
foreground! Use ":gui -f" then.<br>
<br>
<a class="Constant" href="syntax.html#g:syntax_on" name="g:syntax_on">g:syntax_on</a><br>
You can toggle the syntax on/off with this command:<br>
<div class="helpExample"> :if exists("g:syntax_on") | syntax off | else | syntax enable | endif</div>
<br>
To put this into a mapping, you can use:<br>
<div class="helpExample"> :map <F7> :if exists("g:syntax_on") <Bar><br>
\ syntax off <Bar><br>
\ else <Bar><br>
\ syntax enable <Bar><br>
\ endif <CR></div>
[using the <a class="Identifier" href="intro.html#<>"><></a> notation, type this literally]<br>
<br>
Details:<br>
The ":syntax" commands are implemented by sourcing a file. To see exactly how<br>
this works, look in the file:<br>
<span class="PreProc">command file</span><br>
:syntax enable $VIMRUNTIME/syntax/syntax.vim<br>
:syntax on $VIMRUNTIME/syntax/syntax.vim<br>
:syntax manual $VIMRUNTIME/syntax/manual.vim<br>
:syntax off $VIMRUNTIME/syntax/nosyntax.vim<br>
Also see <a class="Identifier" href="syntax.html#syntax-loading">syntax-loading</a>.<br>
<br>
<span class="Todo">NOTE</span>: If displaying long lines is slow and switching off syntax highlighting<br>
makes it fast, consider setting the <a class="Type" href="options.html#'synmaxcol'">'synmaxcol'</a> option to a lower value.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
2. Syntax files <a class="Constant" href="syntax.html#:syn-files" name=":syn-files">:syn-files</a><br>
<br>
The syntax and highlighting commands for one language are normally stored in<br>
a syntax file. The name convention is: "<span class="Special">{name}</span>.vim". Where <span class="Special">{name}</span> is the<br>
name of the language, or an abbreviation (to fit the name in 8.3 characters,<br>
a requirement in case the file is used on a DOS filesystem).<br>
Examples:<br>
c.vim perl.vim java.vim html.vim<br>
cpp.vim sh.vim csh.vim<br>
<br>
The syntax file can contain any Ex commands, just like a vimrc file. But<br>
the idea is that only commands for a specific language are included. When a<br>
language is a superset of another language, it may include the other one,<br>
for example, the cpp.vim file could include the c.vim file:<br>
<div class="helpExample"> :so $VIMRUNTIME/syntax/c.vim</div>
<br>
The .vim files are normally loaded with an autocommand. For example:<br>
<div class="helpExample"> :au Syntax c runtime! syntax/c.vim<br>
:au Syntax cpp runtime! syntax/cpp.vim</div>
These commands are normally in the file $VIMRUNTIME/syntax/synload.vim.<br>
<br>
<br>
<span class="Statement">MAKING YOUR OWN SYNTAX FILES </span><a class="Constant" href="syntax.html#mysyntaxfile" name="mysyntaxfile">mysyntaxfile</a><br>
<br>
When you create your own syntax files, and you want to have Vim use these<br>
automatically with ":syntax enable", do this:<br>
<br>
1. Create your user runtime directory. You would normally use the first item<br>
of the <a class="Type" href="options.html#'runtimepath'">'runtimepath'</a> option. Example for Unix:<br>
<div class="helpExample"> mkdir ~/.vim</div>
<br>
2. Create a directory in there called "syntax". For Unix:<br>
<div class="helpExample"> mkdir ~/.vim/syntax</div>
<br>
3. Write the Vim syntax file. Or download one from the internet. Then write<br>
it in your syntax directory. For example, for the "mine" syntax:<br>
<div class="helpExample"> :w ~/.vim/syntax/mine.vim</div>
<br>
Now you can start using your syntax file manually:<br>
<div class="helpExample"> :set syntax=mine</div>
You don't have to exit Vim to use this.<br>
<br>
If you also want Vim to detect the type of file, see <a class="Identifier" href="filetype.html#new-filetype">new-filetype</a>.<br>
<br>
If you are setting up a system with many users and you don't want each user<br>
to add the same syntax file, you can use another directory from <a class="Type" href="options.html#'runtimepath'">'runtimepath'</a>.<br>
<br>
<br>
<span class="Statement">ADDING TO AN EXISTING SYNTAX FILE </span><a class="Constant" href="syntax.html#mysyntaxfile-add" name="mysyntaxfile-add">mysyntaxfile-add</a><br>
<br>
If you are mostly satisfied with an existing syntax file, but would like to<br>
add a few items or change the highlighting, follow these steps:<br>
<br>
1. Create your user directory from <a class="Type" href="options.html#'runtimepath'">'runtimepath'</a>, see above.<br>
<br>
2. Create a directory in there called "after/syntax". For Unix:<br>
<div class="helpExample"> mkdir ~/.vim/after<br>
mkdir ~/.vim/after/syntax</div>
<br>
3. Write a Vim script that contains the commands you want to use. For<br>
example, to change the colors for the C syntax:<br>
<div class="helpExample"> highlight cComment ctermfg=Green guifg=Green</div>
<br>
4. Write that file in the "after/syntax" directory. Use the name of the<br>
syntax, with ".vim" added. For our C syntax:<br>
<div class="helpExample"> :w ~/.vim/after/syntax/c.vim</div>
<br>
That's it. The next time you edit a C file the Comment color will be<br>
different. You don't even have to restart Vim.<br>
<br>
If you have multiple files, you can use the filetype as the directory name.<br>
All the "*.vim" files in this directory will be used, for example:<br>
~/.vim/after/syntax/c/one.vim<br>
~/.vim/after/syntax/c/two.vim<br>
<br>
<br>
<span class="Statement">REPLACING AN EXISTING SYNTAX FILE </span><a class="Constant" href="syntax.html#mysyntaxfile-replace" name="mysyntaxfile-replace">mysyntaxfile-replace</a><br>
<br>
If you don't like a distributed syntax file, or you have downloaded a new<br>
version, follow the same steps as for <a class="Identifier" href="syntax.html#mysyntaxfile">mysyntaxfile</a> above. Just make sure<br>
that you write the syntax file in a directory that is early in <a class="Type" href="options.html#'runtimepath'">'runtimepath'</a>.<br>
Vim will only load the first syntax file found, assuming that it sets<br>
b:current_syntax.<br>
<br>
<br>
<span class="Statement">NAMING CONVENTIONS </span><a class="Constant" href="syntax.html#group-name" name="group-name">group-name</a> <a class="Constant" href="syntax.html#{group-name}" name="{group-name}">{group-name}</a> <a class="Constant" href="syntax.html#E669" name="E669">E669</a> <a class="Constant" href="syntax.html#W18" name="W18">W18</a><br>
<br>
A syntax group name is to be used for syntax items that match the same kind of<br>
thing. These are then linked to a highlight group that specifies the color.<br>
A syntax group name doesn't specify any color or attributes itself.<br>
<br>
The name for a highlight or syntax group must consist of ASCII letters, digits<br>
and the underscore. As a regexp: "[a-zA-Z0-9_]*". However, Vim does not give<br>
an error when using other characters.<br>
<br>
To be able to allow each user to pick his favorite set of colors, there must<br>
be preferred names for highlight groups that are common for many languages.<br>
These are the suggested group names (if syntax highlighting works properly<br>
you can see the actual color, except for "Ignore"):<br>
<br>
<span class="Comment"> *Comment any comment</span><br>
<br>
<span class="Constant"> *Constant any constant</span><br>
<span class="Constant"> String a string constant: "this is a string"</span><br>
<span class="Constant"> Character a character constant: 'c', '\n'</span><br>
<span class="Constant"> Number a number constant: 234, 0xff</span><br>
<span class="Constant"> Boolean a boolean constant: TRUE, false</span><br>
<span class="Constant"> Float a floating point constant: 2.3e10</span><br>
<br>
<span class="Identifier"> *Identifier any variable name</span><br>
<span class="Identifier"> Function function name (also: methods for classes)</span><br>
<br>
<span class="Statement"> *Statement any statement</span><br>
<span class="Statement"> Conditional if, then, else, endif, switch, etc.</span><br>
<span class="Statement"> Repeat for, do, while, etc.</span><br>
<span class="Statement"> Label case, default, etc.</span><br>
<span class="Statement"> Operator "sizeof", "+", "*", etc.</span><br>
<span class="Statement"> Keyword any other keyword</span><br>
<span class="Statement"> Exception try, catch, throw</span><br>
<br>
<span class="PreProc"> *PreProc generic Preprocessor</span><br>
<span class="PreProc"> Include preprocessor #include</span><br>
<span class="PreProc"> Define preprocessor #define</span><br>
<span class="PreProc"> Macro same as Define</span><br>
<span class="PreProc"> PreCondit preprocessor #if, #else, #endif, etc.</span><br>
<br>
<span class="Type"> *Type int, long, char, etc.</span><br>
<span class="Type"> StorageClass static, register, volatile, etc.</span><br>
<span class="Type"> Structure struct, union, enum, etc.</span><br>
<span class="Type"> Typedef A typedef</span><br>
<br>
<span class="Special"> *Special any special symbol</span><br>
<span class="Special"> SpecialChar special character in a constant</span><br>
<span class="Special"> Tag you can use CTRL-] on this</span><br>
<span class="Special"> Delimiter character that needs attention</span><br>
<span class="Special"> SpecialComment special things inside a comment</span><br>
<span class="Special"> Debug debugging statements</span><br>
<br>
<span class="Underlined"> *Underlined text that stands out, HTML links</span><br>
<br>
*Ignore left blank, hidden <a class="Identifier" href="syntax.html#hl-Ignore">hl-Ignore</a><br>
<br>
<span class="Error"> *Error any erroneous construct</span><br>
<br>
<span class="Todo"> *Todo anything that needs extra attention; mostly the</span><br>
keywords TODO FIXME and XXX<br>
<br>
The names marked with * are the preferred groups; the others are minor groups.<br>
For the preferred groups, the "syntax.vim" file contains default highlighting.<br>
The minor groups are linked to the preferred groups, so they get the same<br>
highlighting. You can override these defaults by using ":highlight" commands<br>
after sourcing the "syntax.vim" file.<br>
<br>
<span class="Todo">Note</span> that highlight group names are not case sensitive. "String" and "string"<br>
can be used for the same group.<br>
<br>
The following names are reserved and cannot be used as a group name:<br>
NONE ALL ALLBUT contains contained<br>
<br>
<a class="Constant" href="syntax.html#hl-Ignore" name="hl-Ignore">hl-Ignore</a><br>
When using the Ignore group, you may also consider using the conceal<br>
mechanism. See <a class="Identifier" href="syntax.html#conceal">conceal</a>.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
3. Syntax loading procedure <a class="Constant" href="syntax.html#syntax-loading" name="syntax-loading">syntax-loading</a><br>
<br>
This explains the details that happen when the command ":syntax enable" is<br>
issued. When Vim initializes itself, it finds out where the runtime files are<br>
located. This is used here as the variable <a class="Identifier" href="starting.html#$VIMRUNTIME">$VIMRUNTIME</a>.<br>
<br>
":syntax enable" and ":syntax on" do the following:<br>
<br>
Source $VIMRUNTIME/syntax/syntax.vim<br>
|<br>
+- Clear out any old syntax by sourcing $VIMRUNTIME/syntax/nosyntax.vim<br>
|<br>
+- Source first syntax/synload.vim in <a class="Type" href="options.html#'runtimepath'">'runtimepath'</a><br>
| |<br>
| +- Setup the colors for syntax highlighting. If a color scheme is<br>
| | defined it is loaded again with ":colors <span class="Special">{name}</span>". Otherwise<br>
| | ":runtime! syntax/syncolor.vim" is used. ":syntax on" overrules<br>
| | existing colors, ":syntax enable" only sets groups that weren't<br>
| | set yet.<br>
| |<br>
| +- Set up syntax autocmds to load the appropriate syntax file when<br>
| | the <a class="Type" href="options.html#'syntax'">'syntax'</a> option is set. <a class="Constant" href="syntax.html#synload-1" name="synload-1">synload-1</a><br>
| |<br>
| +- Source the user's optional file, from the <a class="Identifier" href="syntax.html#mysyntaxfile">mysyntaxfile</a> variable.<br>
| This is for backwards compatibility with Vim 5.x only. <a class="Constant" href="syntax.html#synload-2" name="synload-2">synload-2</a><br>
|<br>
+- Do ":filetype on", which does ":runtime! filetype.vim". It loads any<br>
| filetype.vim files found. It should always Source<br>
| $VIMRUNTIME/filetype.vim, which does the following.<br>
| |<br>
| +- Install autocmds based on suffix to set the <a class="Type" href="options.html#'filetype'">'filetype'</a> option<br>
| | This is where the connection between file name and file type is<br>
| | made for known file types. <a class="Constant" href="syntax.html#synload-3" name="synload-3">synload-3</a><br>
| |<br>
| +- Source the user's optional file, from the <a class="Constant" href="syntax.html#myfiletypefile" name="myfiletypefile">myfiletypefile</a><br>
| | variable. This is for backwards compatibility with Vim 5.x only.<br>
| | <a class="Constant" href="syntax.html#synload-4" name="synload-4">synload-4</a><br>
| |<br>
| +- Install one autocommand which sources scripts.vim when no file<br>
| | type was detected yet. <a class="Constant" href="syntax.html#synload-5" name="synload-5">synload-5</a><br>
| |<br>
| +- Source $VIMRUNTIME/menu.vim, to setup the Syntax menu. <a class="Identifier" href="gui.html#menu.vim">menu.vim</a><br>
|<br>
+- Install a FileType autocommand to set the <a class="Type" href="options.html#'syntax'">'syntax'</a> option when a file<br>
| type has been detected. <a class="Constant" href="syntax.html#synload-6" name="synload-6">synload-6</a><br>
|<br>
+- Execute syntax autocommands to start syntax highlighting for each<br>
already loaded buffer.<br>
<br>
<br>
Upon loading a file, Vim finds the relevant syntax file as follows:<br>
<br>
Loading the file triggers the BufReadPost autocommands.<br>
|<br>
+- If there is a match with one of the autocommands from <a class="Identifier" href="syntax.html#synload-3">synload-3</a><br>
| (known file types) or <a class="Identifier" href="syntax.html#synload-4">synload-4</a> (user's file types), the <a class="Type" href="options.html#'filetype'">'filetype'</a><br>
| option is set to the file type.<br>
|<br>
+- The autocommand at <a class="Identifier" href="syntax.html#synload-5">synload-5</a> is triggered. If the file type was not<br>
| found yet, then scripts.vim is searched for in <a class="Type" href="options.html#'runtimepath'">'runtimepath'</a>. This<br>
| should always load $VIMRUNTIME/scripts.vim, which does the following.<br>
| |<br>
| +- Source the user's optional file, from the <a class="Constant" href="syntax.html#myscriptsfile" name="myscriptsfile">myscriptsfile</a><br>
| | variable. This is for backwards compatibility with Vim 5.x only.<br>
| |<br>
| +- If the file type is still unknown, check the contents of the file,<br>
| again with checks like "getline(1) =~ pattern" as to whether the<br>
| file type can be recognized, and set <a class="Type" href="options.html#'filetype'">'filetype'</a>.<br>
|<br>
+- When the file type was determined and <a class="Type" href="options.html#'filetype'">'filetype'</a> was set, this<br>
| triggers the FileType autocommand <a class="Identifier" href="syntax.html#synload-6">synload-6</a> above. It sets<br>
| <a class="Type" href="options.html#'syntax'">'syntax'</a> to the determined file type.<br>
|<br>
+- When the <a class="Type" href="options.html#'syntax'">'syntax'</a> option was set above, this triggers an autocommand<br>
| from <a class="Identifier" href="syntax.html#synload-1">synload-1</a> (and <a class="Identifier" href="syntax.html#synload-2">synload-2</a>). This find the main syntax file in<br>
| <a class="Type" href="options.html#'runtimepath'">'runtimepath'</a>, with this command:<br>
| runtime! syntax/<span class="Special"><name></span>.vim<br>
|<br>
+- Any other user installed FileType or Syntax autocommands are<br>
triggered. This can be used to change the highlighting for a specific<br>
syntax.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
4. Syntax file remarks <a class="Constant" href="syntax.html#:syn-file-remarks" name=":syn-file-remarks">:syn-file-remarks</a><br>
<br>
<a class="Constant" href="syntax.html#b:current_syntax-variable" name="b:current_syntax-variable">b:current_syntax-variable</a><br>
Vim stores the name of the syntax that has been loaded in the<br>
"b:current_syntax" variable. You can use this if you want to load other<br>
settings, depending on which syntax is active. Example:<br>
<div class="helpExample"> :au BufReadPost * if b:current_syntax == "csh"<br>
:au BufReadPost * do-some-things<br>
:au BufReadPost * endif</div>
<br>
<br>
2HTML <a class="Constant" href="syntax.html#2html.vim" name="2html.vim">2html.vim</a> <a class="Constant" href="syntax.html#convert-to-HTML" name="convert-to-HTML">convert-to-HTML</a><br>
<br>
This is not a syntax file itself, but a script that converts the current<br>
window into HTML. Vim opens a new window in which it builds the HTML file.<br>
<br>
After you save the resulting file, you can view it with any browser. The<br>
colors should be exactly the same as you see them in Vim. With<br>
<a class="Identifier" href="syntax.html#g:html_line_ids">g:html_line_ids</a> you can jump to specific lines by adding (for example) #L123<br>
or #123 to the end of the URL in your browser's address bar. And with<br>
<a class="Identifier" href="syntax.html#g:html_dynamic_folds">g:html_dynamic_folds</a> enabled, you can show or hide the text that is folded<br>
in Vim.<br>
<br>
You are not supposed to set the <a class="Type" href="options.html#'filetype'">'filetype'</a> or <a class="Type" href="options.html#'syntax'">'syntax'</a> option to "2html"!<br>
Source the script to convert the current file:<br>
<br>
<div class="helpExample"> :runtime! syntax/2html.vim</div>
<br>
Many variables affect the output of 2html.vim; see below. Any of the on/off<br>
options listed below can be enabled or disabled by setting them explicitly to<br>
the desired value, or restored to their default by removing the variable using<br>
<a class="Identifier" href="eval.html#:unlet">:unlet</a>.<br>
<br>
Remarks:<br>
- Some truly ancient browsers may not show the background colors.<br>
- From most browsers you can also print the file (in color)!<br>
- The latest TOhtml may actually work with older versions of Vim, but some<br>
features such as conceal support will not function, and the colors may be<br>
incorrect for an old Vim without GUI support compiled in.<br>
<br>
Here is an example how to run the script over all .c and .h files from a<br>
Unix shell:<br>
<div class="helpExample"> for f in *.[ch]; do gvim -f +"syn on" +"run! syntax/2html.vim" +"wq" +"q" $f; done</div>
<br>
<a class="Constant" href="syntax.html#g:html_start_line" name="g:html_start_line">g:html_start_line</a> <a class="Constant" href="syntax.html#g:html_end_line" name="g:html_end_line">g:html_end_line</a><br>
To restrict the conversion to a range of lines, use a range with the <a class="Identifier" href="syntax.html#:TOhtml">:TOhtml</a><br>
command below, or set "g:html_start_line" and "g:html_end_line" to the first<br>
and last line to be converted. Example, using the last set Visual area:<br>
<br>
<div class="helpExample"> :let g:html_start_line = line("'<")<br>
:let g:html_end_line = line("'>")<br>
:runtime! syntax/2html.vim</div>
<br>
<a class="Constant" href="syntax.html#:TOhtml" name=":TOhtml">:TOhtml</a><br>
:<span class="Special">[range]</span>TOhtml The ":TOhtml" command is defined in a standard plugin.<br>
This command will source <a class="Identifier" href="syntax.html#2html.vim">2html.vim</a> for you. When a<br>
range is given, this command sets <a class="Identifier" href="syntax.html#g:html_start_line">g:html_start_line</a><br>
and <a class="Identifier" href="syntax.html#g:html_end_line">g:html_end_line</a> to the start and end of the<br>
range, respectively. Default range is the entire<br>
buffer.<br>
<br>
If the current window is part of a <a class="Identifier" href="diff.html#diff">diff</a>, unless<br>
<a class="Identifier" href="syntax.html#g:html_diff_one_file">g:html_diff_one_file</a> is set, :TOhtml will convert<br>
all windows which are part of the diff in the current<br>
tab and place them side-by-side in a <span class="Special"><table></span> element<br>
in the generated HTML. With <a class="Identifier" href="syntax.html#g:html_line_ids">g:html_line_ids</a> you can<br>
jump to lines in specific windows with (for example)<br>
#W1L42 for line 42 in the first diffed window, or<br>
#W3L87 for line 87 in the third.<br>
<br>
Examples:<br>
<br>
<div class="helpExample"> :10,40TOhtml " convert lines 10-40 to html<br>
:'<,'>TOhtml " convert current/last visual selection<br>
:TOhtml " convert entire buffer</div>
<br>
<a class="Constant" href="syntax.html#g:html_diff_one_file" name="g:html_diff_one_file">g:html_diff_one_file</a><br>
Default: 0.<br>
When 0, and using <a class="Identifier" href="syntax.html#:TOhtml">:TOhtml</a> all windows involved in a <a class="Identifier" href="diff.html#diff">diff</a> in the current tab<br>
page are converted to HTML and placed side-by-side in a <span class="Special"><table></span> element. When<br>
1, only the current buffer is converted.<br>
Example:<br>
<br>
<div class="helpExample"> let g:html_diff_one_file = 1</div>
<br>
<a class="Constant" href="syntax.html#g:html_whole_filler" name="g:html_whole_filler">g:html_whole_filler</a><br>
Default: 0.<br>
When 0, if <a class="Identifier" href="syntax.html#g:html_diff_one_file">g:html_diff_one_file</a> is 1, a sequence of more than 3 filler lines<br>
is displayed as three lines with the middle line mentioning the total number<br>
of inserted lines.<br>
When 1, always display all inserted lines as if <a class="Identifier" href="syntax.html#g:html_diff_one_file">g:html_diff_one_file</a> were<br>
not set.<br>
<br>
<div class="helpExample"> :let g:html_whole_filler = 1</div>
<br>
<a class="Constant" href="syntax.html#TOhtml-performance" name="TOhtml-performance">TOhtml-performance</a> <a class="Constant" href="syntax.html#g:html_no_progress" name="g:html_no_progress">g:html_no_progress</a><br>
Default: 0.<br>
When 0, display a progress bar in the statusline for each major step in the<br>
2html.vim conversion process.<br>
When 1, do not display the progress bar. This offers a minor speed improvement<br>
but you won't have any idea how much longer the conversion might take; for big<br>
files it can take a long time!<br>
Example:<br>
<br>
<div class="helpExample"> let g:html_no_progress = 1</div>
<br>
You can obtain better performance improvements by also instructing Vim to not<br>
run interactively, so that too much time is not taken to redraw as the script<br>
moves through the buffer, switches windows, and the like:<br>
<br>
<div class="helpExample"> vim -E -s -c "let g:html_no_progress=1" -c "syntax on" -c "set ft=c" -c "runtime syntax/2html.vim" -cwqa myfile.c</div>
<br>
<span class="Todo">Note</span> that the -s flag prevents loading your .vimrc and any plugins, so you<br>
need to explicitly source/enable anything that will affect the HTML<br>
conversion. See <a class="Identifier" href="starting.html#-E">-E</a> and <a class="Identifier" href="starting.html#-s-ex">-s-ex</a> for details. It is probably best to create a<br>
script to replace all the -c commands and use it with the -u flag instead of<br>
specifying each command separately.<br>
<br>
<a class="Constant" href="syntax.html#g:html_number_lines" name="g:html_number_lines">g:html_number_lines</a><br>
Default: current <a class="Type" href="options.html#'number'">'number'</a> setting.<br>
When 0, buffer text is displayed in the generated HTML without line numbering.<br>
When 1, a column of line numbers is added to the generated HTML with the same<br>
highlighting as the line number column in Vim (<a class="Identifier" href="syntax.html#hl-LineNr">hl-LineNr</a>).<br>
Force line numbers even if <a class="Type" href="options.html#'number'">'number'</a> is not set:<br>
<div class="helpExample"> :let g:html_number_lines = 1</div>
Force to omit the line numbers:<br>
<div class="helpExample"> :let g:html_number_lines = 0</div>
Go back to the default to use <a class="Type" href="options.html#'number'">'number'</a> by deleting the variable:<br>
<div class="helpExample"> :unlet g:html_number_lines</div>
<br>
<span class="Statement"> </span><a class="Constant" href="syntax.html#g:html_line_ids" name="g:html_line_ids">g:html_line_ids</a><br>
Default: 1 if <a class="Identifier" href="syntax.html#g:html_number_lines">g:html_number_lines</a> is set, 0 otherwise.<br>
When 1, adds an HTML id attribute to each line number, or to an empty <span class="Special"><span></span><br>
inserted for that purpose if no line numbers are shown. This ID attribute<br>
takes the form of L123 for single-buffer HTML pages, or W2L123 for diff-view<br>
pages, and is used to jump to a specific line (in a specific window of a diff<br>
view). Javascript is inserted to open any closed dynamic folds<br>
(<a class="Identifier" href="syntax.html#g:html_dynamic_folds">g:html_dynamic_folds</a>) containing the specified line before jumping. The<br>
javascript also allows omitting the window ID in the url, and the leading L.<br>
For example:<br>
<br>
<div class="helpExample"> page.html#L123 jumps to line 123 in a single-buffer file<br>
page.html#123 does the same</div>
<br>
<div class="helpExample"> diff.html#W1L42 jumps to line 42 in the first window in a diff<br>
diff.html#42 does the same</div>
<br>
<a class="Constant" href="syntax.html#g:html_use_css" name="g:html_use_css">g:html_use_css</a><br>
Default: 1.<br>
When 1, generate valid HTML 4.01 markup with CSS1 styling, supported in all<br>
modern browsers and most old browsers.<br>
When 0, generate <span class="Special"><font></span> tags and similar outdated markup. This is not<br>
recommended but it may work better in really old browsers, email clients,<br>
forum posts, and similar situations where basic CSS support is unavailable.<br>
Example:<br>
<div class="helpExample"> :let g:html_use_css = 0</div>
<br>
<a class="Constant" href="syntax.html#g:html_ignore_conceal" name="g:html_ignore_conceal">g:html_ignore_conceal</a><br>
Default: 0.<br>
When 0, concealed text is removed from the HTML and replaced with a character<br>
from <a class="Identifier" href="syntax.html#:syn-cchar">:syn-cchar</a> or <a class="Type" href="options.html#'listchars'">'listchars'</a> as appropriate, depending on the current<br>
value of <a class="Type" href="options.html#'conceallevel'">'conceallevel'</a>.<br>
When 1, include all text from the buffer in the generated HTML, even if it is<br>
<a class="Identifier" href="syntax.html#conceal">conceal</a>ed.<br>
<br>
Either of the following commands will ensure that all text in the buffer is<br>
included in the generated HTML (unless it is folded):<br>
<div class="helpExample"> :let g:html_ignore_conceal = 1<br>
:setl conceallevel=0</div>
<br>
<a class="Constant" href="syntax.html#g:html_ignore_folding" name="g:html_ignore_folding">g:html_ignore_folding</a><br>
Default: 0.<br>
When 0, text in a closed fold is replaced by the text shown for the fold in<br>
Vim (<a class="Identifier" href="fold.html#fold-foldtext">fold-foldtext</a>). See <a class="Identifier" href="syntax.html#g:html_dynamic_folds">g:html_dynamic_folds</a> if you also want to allow<br>
the user to expand the fold as in Vim to see the text inside.<br>
When 1, include all text from the buffer in the generated HTML; whether the<br>
text is in a fold has no impact at all. <a class="Identifier" href="syntax.html#g:html_dynamic_folds">g:html_dynamic_folds</a> has no effect.<br>
<br>
Either of these commands will ensure that all text in the buffer is included<br>
in the generated HTML (unless it is concealed):<br>
<div class="helpExample"> zR<br>
:let g:html_ignore_folding = 1</div>
<br>
<a class="Constant" href="syntax.html#g:html_dynamic_folds" name="g:html_dynamic_folds">g:html_dynamic_folds</a><br>
Default: 0.<br>
When 0, text in a closed fold is not included at all in the generated HTML.<br>
When 1, generate javascript to open a fold and show the text within, just like<br>
in Vim.<br>
<br>
Setting this variable to 1 causes 2html.vim to always use CSS for styling,<br>
regardless of what <a class="Identifier" href="syntax.html#g:html_use_css">g:html_use_css</a> is set to.<br>
<br>
This variable is ignored when <a class="Identifier" href="syntax.html#g:html_ignore_folding">g:html_ignore_folding</a> is set.<br>
<br>
<div class="helpExample"> :let g:html_dynamic_folds = 1</div>
<br>
<a class="Constant" href="syntax.html#g:html_no_foldcolumn" name="g:html_no_foldcolumn">g:html_no_foldcolumn</a><br>
Default: 0.<br>
When 0, if <a class="Identifier" href="syntax.html#g:html_dynamic_folds">g:html_dynamic_folds</a> is 1, generate a column of text similar to<br>
Vim's foldcolumn (<a class="Identifier" href="fold.html#fold-foldcolumn">fold-foldcolumn</a>) the user can click on to toggle folds<br>
open or closed. The minimum width of the generated text column is the current<br>
<a class="Type" href="options.html#'foldcolumn'">'foldcolumn'</a> setting.<br>
When 1, do not generate this column; instead, hovering the mouse cursor over<br>
folded text will open the fold as if <a class="Identifier" href="syntax.html#g:html_hover_unfold">g:html_hover_unfold</a> were set.<br>
<br>
<div class="helpExample"> :let g:html_no_foldcolumn = 1</div>
<br>
<a class="Constant" href="syntax.html#TOhtml-uncopyable-text" name="TOhtml-uncopyable-text">TOhtml-uncopyable-text</a> <a class="Constant" href="syntax.html#g:html_prevent_copy" name="g:html_prevent_copy">g:html_prevent_copy</a><br>
Default: empty string.<br>
This option prevents certain regions of the generated HTML from being copied,<br>
when you select all text in document rendered in a browser and copy it. Useful<br>
for allowing users to copy-paste only the source text even if a fold column or<br>
line numbers are shown in the generated content. Specify regions to be<br>
affected in this way as follows:<br>
f: fold column<br>
n: line numbers (also within fold text)<br>
t: fold text<br>
d: diff filler<br>
<br>
Example, to make the fold column and line numbers uncopyable:<br>
<div class="helpExample"> :let g:html_prevent_copy = "fn"</div>
<br>
This feature is currently implemented by inserting read-only <span class="Special"><input></span> elements<br>
into the markup to contain the uncopyable areas. This does not work well in<br>
all cases. When pasting to some applications which understand HTML, the<br>
<span class="Special"><input></span> elements also get pasted. But plain-text paste destinations should<br>
always work.<br>
<br>
<a class="Constant" href="syntax.html#g:html_no_invalid" name="g:html_no_invalid">g:html_no_invalid</a><br>
Default: 0.<br>
When 0, if <a class="Identifier" href="syntax.html#g:html_prevent_copy">g:html_prevent_copy</a> is non-empty, an invalid attribute is<br>
intentionally inserted into the <span class="Special"><input></span> element for the uncopyable areas. This<br>
increases the number of applications you can paste to without also pasting the<br>
<span class="Special"><input></span> elements. Specifically, Microsoft Word will not paste the <span class="Special"><input></span><br>
elements if they contain this invalid attribute.<br>
When 1, no invalid markup is ever intentionally inserted, and the generated<br>
page should validate. However, be careful pasting into Microsoft Word when<br>
<a class="Identifier" href="syntax.html#g:html_prevent_copy">g:html_prevent_copy</a> is non-empty; it can be hard to get rid of the <span class="Special"><input></span><br>
elements which get pasted.<br>
<br>
<a class="Constant" href="syntax.html#g:html_hover_unfold" name="g:html_hover_unfold">g:html_hover_unfold</a><br>
Default: 0.<br>
When 0, the only way to open a fold generated by 2html.vim with<br>
<a class="Identifier" href="syntax.html#g:html_dynamic_folds">g:html_dynamic_folds</a> set, is to click on the generated fold column.<br>
When 1, use CSS 2.0 to allow the user to open a fold by moving the mouse<br>
cursor over the displayed fold text. This is useful to allow users with<br>
disabled javascript to view the folded text.<br>
<br>
<span class="Todo">Note</span> that old browsers (notably Internet Explorer 6) will not support this<br>
feature. Browser-specific markup for IE6 is included to fall back to the<br>
normal CSS1 styling so that the folds show up correctly for this browser, but<br>
they will not be openable without a foldcolumn.<br>
<br>
<div class="helpExample"> :let g:html_hover_unfold = 1</div>
<br>
<a class="Constant" href="syntax.html#g:html_id_expr" name="g:html_id_expr">g:html_id_expr</a><br>
Default: ""<br>
Dynamic folding and jumping to line IDs rely on unique IDs within the document<br>
to work. If generated HTML is copied into a larger document, these IDs are no<br>
longer guaranteed to be unique. Set g:html_id_expr to an expression Vim can<br>
evaluate to get a unique string to append to each ID used in a given document,<br>
so that the full IDs will be unique even when combined with other content in a<br>
larger HTML document. Example, to append _ and the buffer number to each ID:<br>
<br>
<div class="helpExample"> :let g:html_id_expr = '"_".bufnr("%")'</div>
<br>
To append a string "_mystring" to the end of each ID:<br>
<br>
<div class="helpExample"> :let g:html_id_expr = '"_mystring"'</div>
<br>
<span class="Todo">Note</span>, when converting a diff view to HTML, the expression will only be<br>
evaluated for the first window in the diff, and the result used for all the<br>
windows.<br>
<br>
<a class="Constant" href="syntax.html#TOhtml-wrap-text" name="TOhtml-wrap-text">TOhtml-wrap-text</a> <a class="Constant" href="syntax.html#g:html_pre_wrap" name="g:html_pre_wrap">g:html_pre_wrap</a><br>
Default: current <a class="Type" href="options.html#'wrap'">'wrap'</a> setting.<br>
When 0, if <a class="Identifier" href="syntax.html#g:html_no_pre">g:html_no_pre</a> is 0 or unset, the text in the generated HTML does<br>
not wrap at the edge of the browser window.<br>
When 1, if <a class="Identifier" href="syntax.html#g:html_use_css">g:html_use_css</a> is 1, the CSS 2.0 "white-space:pre-wrap" value is<br>
used, causing the text to wrap at whitespace at the edge of the browser<br>
window.<br>
Explicitly enable text wrapping:<br>
<div class="helpExample"> :let g:html_pre_wrap = 1</div>
Explicitly disable wrapping:<br>
<div class="helpExample"> :let g:html_pre_wrap = 0</div>
Go back to default, determine wrapping from <a class="Type" href="options.html#'wrap'">'wrap'</a> setting:<br>
<div class="helpExample"> :unlet g:html_pre_wrap</div>
<br>
<a class="Constant" href="syntax.html#g:html_no_pre" name="g:html_no_pre">g:html_no_pre</a><br>
Default: 0.<br>
When 0, buffer text in the generated HTML is surrounded by <span class="Special"><pre></span>...</pre><br>
tags. Series of whitespace is shown as in Vim without special markup, and tab<br>
characters can be included literally (see <a class="Identifier" href="syntax.html#g:html_expand_tabs">g:html_expand_tabs</a>).<br>
When 1 (not recommended), the <span class="Special"><pre></span> tags are omitted, and a plain <span class="Special"><div></span> is<br>
used instead. Whitespace is replaced by a series of &nbsp; character<br>
references, and <span class="Special"><br></span> is used to end each line. This is another way to allow<br>
text in the generated HTML is wrap (see <a class="Identifier" href="syntax.html#g:html_pre_wrap">g:html_pre_wrap</a>) which also works in<br>
old browsers, but may cause noticeable differences between Vim's display and<br>
the rendered page generated by 2html.vim.<br>
<br>
<div class="helpExample"> :let g:html_no_pre = 1</div>
<br>
<a class="Constant" href="syntax.html#g:html_expand_tabs" name="g:html_expand_tabs">g:html_expand_tabs</a><br>
Default: 1 if <a class="Type" href="options.html#'tabstop'">'tabstop'</a> is 8, <a class="Type" href="options.html#'expandtab'">'expandtab'</a> is 0, and no fold column or line<br>
numbers occur in the generated HTML;<br>
0 otherwise.<br>
When 0, <span class="Special"><Tab></span> characters in the buffer text are replaced with an appropriate<br>
number of space characters, or &nbsp; references if <a class="Identifier" href="syntax.html#g:html_no_pre">g:html_no_pre</a> is 1.<br>
When 1, if <a class="Identifier" href="syntax.html#g:html_no_pre">g:html_no_pre</a> is 0 or unset, <span class="Special"><Tab></span> characters in the buffer text<br>
are included as-is in the generated HTML. This is useful for when you want to<br>
allow copy and paste from a browser without losing the actual whitespace in<br>
the source document. <span class="Todo">Note</span> that this can easily break text alignment and<br>
indentation in the HTML, unless set by default.<br>
<br>
Force <a class="Identifier" href="syntax.html#2html.vim">2html.vim</a> to keep <span class="Special"><Tab></span> characters:<br>
<div class="helpExample"> :let g:html_expand_tabs = 0</div>
<br>
Force tabs to be expanded:<br>
<div class="helpExample"> :let g:html_expand_tabs = 1</div>
<br>
<a class="Constant" href="syntax.html#TOhtml-encoding-detect" name="TOhtml-encoding-detect">TOhtml-encoding-detect</a> <a class="Constant" href="syntax.html#TOhtml-encoding" name="TOhtml-encoding">TOhtml-encoding</a><br>
It is highly recommended to set your desired encoding with<br>
<a class="Identifier" href="syntax.html#g:html_use_encoding">g:html_use_encoding</a> for any content which will be placed on a web server.<br>
<br>
If you do not specify an encoding, <a class="Identifier" href="syntax.html#2html.vim">2html.vim</a> uses the preferred IANA name<br>
for the current value of <a class="Type" href="options.html#'fileencoding'">'fileencoding'</a> if set, or <a class="Type" href="options.html#'encoding'">'encoding'</a> if not.<br>
<a class="Type" href="options.html#'encoding'">'encoding'</a> is always used for certain <a class="Type" href="options.html#'buftype'">'buftype'</a> values. <a class="Type" href="options.html#'fileencoding'">'fileencoding'</a> will be<br>
set to match the chosen document encoding.<br>
<br>
Automatic detection works for the encodings mentioned specifically by name in<br>
<a class="Identifier" href="mbyte.html#encoding-names">encoding-names</a>, but TOhtml will only automatically use those encodings with<br>
wide browser support. However, you can override this to support specific<br>
encodings that may not be automatically detected by default (see options<br>
below). See <span class="Constant"><a href="http://www.iana.org/assignments/character-sets">http://www.iana.org/assignments/character-sets</a></span> for the IANA names.<br>
<br>
<span class="Todo">Note</span>, by default all Unicode encodings are converted to UTF-8 with no BOM in<br>
the generated HTML, as recommended by W3C:<br>
<br>
<span class="Constant"><a href="http://www.w3.org/International/questions/qa-choosing-encodings">http://www.w3.org/International/questions/qa-choosing-encodings</a></span><br>
<span class="Constant"><a href="http://www.w3.org/International/questions/qa-byte-order-mark">http://www.w3.org/International/questions/qa-byte-order-mark</a></span><br>
<br>
<a class="Constant" href="syntax.html#g:html_use_encoding" name="g:html_use_encoding">g:html_use_encoding</a><br>
Default: none, uses IANA name for current <a class="Type" href="options.html#'fileencoding'">'fileencoding'</a> as above.<br>
To overrule all automatic charset detection, set g:html_use_encoding to the<br>
name of the charset to be used. It is recommended to set this variable to<br>
something widely supported, like UTF-8, for anything you will be hosting on a<br>
webserver:<br>
<div class="helpExample"> :let g:html_use_encoding = "UTF-8"</div>
You can also use this option to omit the line that specifies the charset<br>
entirely, by setting g:html_use_encoding to an empty string (NOT recommended):<br>
<div class="helpExample"> :let g:html_use_encoding = ""</div>
To go back to the automatic mechanism, delete the <a class="Identifier" href="syntax.html#g:html_use_encoding">g:html_use_encoding</a><br>
variable:<br>
<div class="helpExample"> :unlet g:html_use_encoding</div>
<br>
<a class="Constant" href="syntax.html#g:html_encoding_override" name="g:html_encoding_override">g:html_encoding_override</a><br>
Default: none, autoload/tohtml.vim contains default conversions for encodings<br>
mentioned by name at <a class="Identifier" href="mbyte.html#encoding-names">encoding-names</a>.<br>
This option allows <a class="Identifier" href="syntax.html#2html.vim">2html.vim</a> to detect the correct <a class="Type" href="options.html#'fileencoding'">'fileencoding'</a> when you<br>
specify an encoding with <a class="Identifier" href="syntax.html#g:html_use_encoding">g:html_use_encoding</a> which is not in the default<br>
list of conversions.<br>
<br>
This is a dictionary of charset-encoding pairs that will replace existing<br>
pairs automatically detected by TOhtml, or supplement with new pairs.<br>
<br>
Detect the HTML charset "windows-1252" as the encoding "8bit-cp1252":<br>
<div class="helpExample"> :let g:html_encoding_override = {'windows-1252': '8bit-cp1252'}</div>
<br>
<a class="Constant" href="syntax.html#g:html_charset_override" name="g:html_charset_override">g:html_charset_override</a><br>
Default: none, autoload/tohtml.vim contains default conversions for encodings<br>
mentioned by name at <a class="Identifier" href="mbyte.html#encoding-names">encoding-names</a> and which have wide<br>
browser support.<br>
This option allows <a class="Identifier" href="syntax.html#2html.vim">2html.vim</a> to detect the HTML charset for any<br>
<a class="Type" href="options.html#'fileencoding'">'fileencoding'</a> or <a class="Type" href="options.html#'encoding'">'encoding'</a> which is not detected automatically. You can also<br>
use it to override specific existing encoding-charset pairs. For example,<br>
TOhtml will by default use UTF-8 for all Unicode/UCS encodings. To use UTF-16<br>
and UTF-32 instead, use:<br>
<div class="helpExample"> :let g:html_charset_override = {'ucs-4': 'UTF-32', 'utf-16': 'UTF-16'}</div>
<br>
<span class="Todo">Note</span> that documents encoded in either UTF-32 or UTF-16 have known<br>
compatibility problems with some major browsers.<br>
<br>
<a class="Constant" href="syntax.html#g:html_font" name="g:html_font">g:html_font</a><br>
Default: "monospace"<br>
You can specify the font or fonts used in the converted document using<br>
g:html_font. If this option is set to a string, then the value will be<br>
surrounded with single quotes. If this option is set to a list then each list<br>
item is surrounded by single quotes and the list is joined with commas. Either<br>
way, "monospace" is added as the fallback generic family name and the entire<br>
result used as the font family (using CSS) or font face (if not using CSS).<br>
Examples:<br>
<br>
<div class="helpExample"> " font-family: 'Consolas', monospace;<br>
:let g:html_font = "Consolas"</div>
<br>
<div class="helpExample"> " font-family: 'DejaVu Sans Mono', 'Consolas', monospace;<br>
:let g:html_font = ["DejaVu Sans Mono", "Consolas"]</div>
<br>
<a class="Constant" href="syntax.html#convert-to-XML" name="convert-to-XML">convert-to-XML</a> <a class="Constant" href="syntax.html#convert-to-XHTML" name="convert-to-XHTML">convert-to-XHTML</a> <a class="Constant" href="syntax.html#g:html_use_xhtml" name="g:html_use_xhtml">g:html_use_xhtml</a><br>
Default: 0.<br>
When 0, generate standard HTML 4.01 (strict when possible).<br>
When 1, generate XHTML 1.0 instead (XML compliant HTML).<br>
<br>
<div class="helpExample"> :let g:html_use_xhtml = 1</div>
<br>
<br>
<span class="Statement">ABEL </span><a class="Constant" href="syntax.html#abel.vim" name="abel.vim">abel.vim</a> <a class="Constant" href="syntax.html#ft-abel-syntax" name="ft-abel-syntax">ft-abel-syntax</a><br>
<br>
ABEL highlighting provides some user-defined options. To enable them, assign<br>
any value to the respective variable. Example:<br>
<div class="helpExample"> :let abel_obsolete_ok=1</div>
To disable them use ":unlet". Example:<br>
<div class="helpExample"> :unlet abel_obsolete_ok</div>
<br>
<span class="PreProc">Variable Highlight</span><br>
abel_obsolete_ok obsolete keywords are statements, not errors<br>
abel_cpp_comments_illegal do not interpret '//' as inline comment leader<br>
<br>
<br>
ADA<br>
<br>
See <a class="Identifier" href="ft_ada.html#ft-ada-syntax">ft-ada-syntax</a><br>
<br>
<br>
<span class="Statement">ANT </span><a class="Constant" href="syntax.html#ant.vim" name="ant.vim">ant.vim</a> <a class="Constant" href="syntax.html#ft-ant-syntax" name="ft-ant-syntax">ft-ant-syntax</a><br>
<br>
The ant syntax file provides syntax highlighting for javascript and python<br>
by default. Syntax highlighting for other script languages can be installed<br>
by the function AntSyntaxScript(), which takes the tag name as first argument<br>
and the script syntax file name as second argument. Example:<br>
<br>
<div class="helpExample"> :call AntSyntaxScript('perl', 'perl.vim')</div>
<br>
will install syntax perl highlighting for the following ant code<br>
<br>
<div class="helpExample"> <script language = 'perl'><![CDATA[<br>
# everything inside is highlighted as perl<br>
]]></script></div>
<br>
See <a class="Identifier" href="syntax.html#mysyntaxfile-add">mysyntaxfile-add</a> for installing script languages permanently.<br>
<br>
<br>
<span class="Statement">APACHE </span><a class="Constant" href="syntax.html#apache.vim" name="apache.vim">apache.vim</a> <a class="Constant" href="syntax.html#ft-apache-syntax" name="ft-apache-syntax">ft-apache-syntax</a><br>
<br>
The apache syntax file provides syntax highlighting depending on Apache HTTP<br>
server version, by default for 1.3.x. Set "apache_version" to Apache version<br>
(as a string) to get highlighting for another version. Example:<br>
<br>
<div class="helpExample"> :let apache_version = "2.0"</div>
<br>
<br>
<a class="Constant" href="syntax.html#asm.vim" name="asm.vim">asm.vim</a> <a class="Constant" href="syntax.html#asmh8300.vim" name="asmh8300.vim">asmh8300.vim</a> <a class="Constant" href="syntax.html#nasm.vim" name="nasm.vim">nasm.vim</a> <a class="Constant" href="syntax.html#masm.vim" name="masm.vim">masm.vim</a> <a class="Constant" href="syntax.html#asm68k" name="asm68k">asm68k</a><br>
<span class="Statement">ASSEMBLY </span><a class="Constant" href="syntax.html#ft-asm-syntax" name="ft-asm-syntax">ft-asm-syntax</a> <a class="Constant" href="syntax.html#ft-asmh8300-syntax" name="ft-asmh8300-syntax">ft-asmh8300-syntax</a> <a class="Constant" href="syntax.html#ft-nasm-syntax" name="ft-nasm-syntax">ft-nasm-syntax</a><br>
<a class="Constant" href="syntax.html#ft-masm-syntax" name="ft-masm-syntax">ft-masm-syntax</a> <a class="Constant" href="syntax.html#ft-asm68k-syntax" name="ft-asm68k-syntax">ft-asm68k-syntax</a> <a class="Constant" href="syntax.html#fasm.vim" name="fasm.vim">fasm.vim</a><br>
<br>
Files matching "*.i" could be Progress or Assembly. If the automatic detection<br>
doesn't work for you, or you don't edit Progress at all, use this in your<br>
startup vimrc:<br>
<div class="helpExample"> :let filetype_i = "asm"</div>
Replace "asm" with the type of assembly you use.<br>
<br>
There are many types of assembly languages that all use the same file name<br>
extensions. Therefore you will have to select the type yourself, or add a<br>
line in the assembly file that Vim will recognize. Currently these syntax<br>
files are included:<br>
asm GNU assembly (the default)<br>
asm68k Motorola 680x0 assembly<br>
asmh8300 Hitachi H-8300 version of GNU assembly<br>
ia64 Intel Itanium 64<br>
fasm Flat assembly (<span class="Constant"><a href="http://flatassembler.net">http://flatassembler.net</a></span>)<br>
masm Microsoft assembly (probably works for any 80x86)<br>
nasm Netwide assembly<br>
tasm Turbo Assembly (with opcodes 80x86 up to Pentium, and<br>
MMX)<br>
pic PIC assembly (currently for PIC16F84)<br>
<br>
The most flexible is to add a line in your assembly file containing:<br>
<div class="helpExample"> asmsyntax=nasm</div>
Replace "nasm" with the name of the real assembly syntax. This line must be<br>
one of the first five lines in the file. No non-white text must be<br>
immediately before or after this text. <span class="Todo">Note</span> that specifying asmsyntax=foo is<br>
equivalent to setting ft=foo in a <a class="Identifier" href="options.html#modeline">modeline</a>, and that in case of a conflict<br>
between the two settings the one from the modeline will take precedence (in<br>
particular, if you have ft=asm in the modeline, you will get the GNU syntax<br>
highlighting regardless of what is specified as asmsyntax).<br>
<br>
The syntax type can always be overruled for a specific buffer by setting the<br>
b:asmsyntax variable:<br>
<div class="helpExample"> :let b:asmsyntax = "nasm"</div>
<br>
If b:asmsyntax is not set, either automatically or by hand, then the value of<br>
the global variable asmsyntax is used. This can be seen as a default assembly<br>
language:<br>
<div class="helpExample"> :let asmsyntax = "nasm"</div>
<br>
As a last resort, if nothing is defined, the "asm" syntax is used.<br>
<br>
<br>
<span class="PreProc">Netwide assembler (nasm.vim) optional highlighting</span><br>
<br>
To enable a feature:<br>
<div class="helpExample"> :let {variable}=1|set syntax=nasm</div>
To disable a feature:<br>
<div class="helpExample"> :unlet {variable} |set syntax=nasm</div>
<br>
<span class="PreProc">Variable Highlight</span><br>
nasm_loose_syntax unofficial parser allowed syntax not as Error<br>
(parser dependent; not recommended)<br>
nasm_ctx_outside_macro contexts outside macro not as Error<br>
nasm_no_warn potentially risky syntax not as ToDo<br>
<br>
<br>
ASPPERL and ASPVBS <a class="Constant" href="syntax.html#ft-aspperl-syntax" name="ft-aspperl-syntax">ft-aspperl-syntax</a> <a class="Constant" href="syntax.html#ft-aspvbs-syntax" name="ft-aspvbs-syntax">ft-aspvbs-syntax</a><br>
<br>
*.asp and *.asa files could be either Perl or Visual Basic script. Since it's<br>
hard to detect this you can set two global variables to tell Vim what you are<br>
using. For Perl script use:<br>
<div class="helpExample"> :let g:filetype_asa = "aspperl"<br>
:let g:filetype_asp = "aspperl"</div>
For Visual Basic use:<br>
<div class="helpExample"> :let g:filetype_asa = "aspvbs"<br>
:let g:filetype_asp = "aspvbs"</div>
<br>
<br>
<span class="Statement">BAAN </span><a class="Constant" href="syntax.html#baan.vim" name="baan.vim">baan.vim</a> <a class="Constant" href="syntax.html#baan-syntax" name="baan-syntax">baan-syntax</a><br>
<br>
The baan.vim gives syntax support for BaanC of release BaanIV upto SSA ERP LN<br>
for both 3 GL and 4 GL programming. Large number of standard defines/constants<br>
are supported.<br>
<br>
Some special violation of coding standards will be signalled when one specify<br>
in ones <a class="Identifier" href="starting.html#.vimrc">.vimrc</a>:<br>
<div class="helpExample"> let baan_code_stds=1</div>
<br>
<a class="Constant" href="syntax.html#baan-folding" name="baan-folding">baan-folding</a><br>
<br>
Syntax folding can be enabled at various levels through the variables<br>
mentioned below (Set those in your <a class="Identifier" href="starting.html#.vimrc">.vimrc</a>). The more complex folding on<br>
source blocks and SQL can be CPU intensive.<br>
<br>
To allow any folding and enable folding at function level use:<br>
<div class="helpExample"> let baan_fold=1</div>
Folding can be enabled at source block level as if, while, for ,... The<br>
indentation preceding the begin/end keywords has to match (spaces are not<br>
considered equal to a tab).<br>
<div class="helpExample"> let baan_fold_block=1</div>
Folding can be enabled for embedded SQL blocks as SELECT, SELECTDO,<br>
SELECTEMPTY, ... The indentation preceding the begin/end keywords has to<br>
match (spaces are not considered equal to a tab).<br>
<div class="helpExample"> let baan_fold_sql=1</div>
<span class="Todo">Note</span>: Block folding can result in many small folds. It is suggested to <a class="Identifier" href="options.html#:set">:set</a><br>
the options <a class="Type" href="options.html#'foldminlines'">'foldminlines'</a> and <a class="Type" href="options.html#'foldnestmax'">'foldnestmax'</a> in <a class="Identifier" href="starting.html#.vimrc">.vimrc</a> or use <a class="Identifier" href="options.html#:setlocal">:setlocal</a> in<br>
.../after/syntax/baan.vim (see <a class="Identifier" href="options.html#after-directory">after-directory</a>). Eg:<br>
<div class="helpExample"> set foldminlines=5<br>
set foldnestmax=6</div>
<br>
<br>
<span class="Statement">BASIC </span><a class="Constant" href="syntax.html#basic.vim" name="basic.vim">basic.vim</a> <a class="Constant" href="syntax.html#vb.vim" name="vb.vim">vb.vim</a> <a class="Constant" href="syntax.html#ft-basic-syntax" name="ft-basic-syntax">ft-basic-syntax</a> <a class="Constant" href="syntax.html#ft-vb-syntax" name="ft-vb-syntax">ft-vb-syntax</a><br>
<br>
Both Visual Basic and "normal" basic use the extension ".bas". To detect<br>
which one should be used, Vim checks for the string "VB_Name" in the first<br>
five lines of the file. If it is not found, filetype will be "basic",<br>
otherwise "vb". Files with the ".frm" extension will always be seen as Visual<br>
Basic.<br>
<br>
<br>
<span class="Statement">C </span><a class="Constant" href="syntax.html#c.vim" name="c.vim">c.vim</a> <a class="Constant" href="syntax.html#ft-c-syntax" name="ft-c-syntax">ft-c-syntax</a><br>
<br>
A few things in C highlighting are optional. To enable them assign any value<br>
to the respective variable. Example:<br>
<div class="helpExample"> :let c_comment_strings = 1</div>
To disable them use ":unlet". Example:<br>
<div class="helpExample"> :unlet c_comment_strings</div>
<br>
<span class="PreProc">Variable Highlight</span><br>
<a class="Constant" href="syntax.html#c_gnu" name="c_gnu">c_gnu</a> GNU gcc specific items<br>
<a class="Constant" href="syntax.html#c_comment_strings" name="c_comment_strings">c_comment_strings</a> strings and numbers inside a comment<br>
<a class="Constant" href="syntax.html#c_space_errors" name="c_space_errors">c_space_errors</a> trailing white space and spaces before a <span class="Special"><Tab></span><br>
<a class="Constant" href="syntax.html#c_no_trail_space_error" name="c_no_trail_space_error">c_no_trail_space_error</a> ... but no trailing spaces<br>
<a class="Constant" href="syntax.html#c_no_tab_space_error" name="c_no_tab_space_error">c_no_tab_space_error</a> ... but no spaces before a <span class="Special"><Tab></span><br>
<a class="Constant" href="syntax.html#c_no_bracket_error" name="c_no_bracket_error">c_no_bracket_error</a> don't highlight {}; inside [] as errors<br>
<a class="Constant" href="syntax.html#c_no_curly_error" name="c_no_curly_error">c_no_curly_error</a> don't highlight {}; inside [] and () as errors;<br>
except { and } in first column<br>
Default is to highlight them, otherwise you<br>
can't spot a missing ")".<br>
<a class="Constant" href="syntax.html#c_curly_error" name="c_curly_error">c_curly_error</a> highlight a missing }; this forces syncing from the<br>
start of the file, can be slow<br>
<a class="Constant" href="syntax.html#c_no_ansi" name="c_no_ansi">c_no_ansi</a> don't do standard ANSI types and constants<br>
<a class="Constant" href="syntax.html#c_ansi_typedefs" name="c_ansi_typedefs">c_ansi_typedefs</a> ... but do standard ANSI types<br>
<a class="Constant" href="syntax.html#c_ansi_constants" name="c_ansi_constants">c_ansi_constants</a> ... but do standard ANSI constants<br>
<a class="Constant" href="syntax.html#c_no_utf" name="c_no_utf">c_no_utf</a> don't highlight \u and \U in strings<br>
<a class="Constant" href="syntax.html#c_syntax_for_h" name="c_syntax_for_h">c_syntax_for_h</a> for *.h files use C syntax instead of C++ and use objc<br>
syntax instead of objcpp<br>
<a class="Constant" href="syntax.html#c_no_if0" name="c_no_if0">c_no_if0</a> don't highlight "#if 0" blocks as comments<br>
<a class="Constant" href="syntax.html#c_no_cformat" name="c_no_cformat">c_no_cformat</a> don't highlight %-formats in strings<br>
<a class="Constant" href="syntax.html#c_no_c99" name="c_no_c99">c_no_c99</a> don't highlight C99 standard items<br>
<a class="Constant" href="syntax.html#c_no_c11" name="c_no_c11">c_no_c11</a> don't highlight C11 standard items<br>
<a class="Constant" href="syntax.html#c_no_bsd" name="c_no_bsd">c_no_bsd</a> don't highlight BSD specific types<br>
<br>
When <a class="Type" href="options.html#'foldmethod'">'foldmethod'</a> is set to "syntax" then /* */ comments and { } blocks will<br>
become a fold. If you don't want comments to become a fold use:<br>
<div class="helpExample"> :let c_no_comment_fold = 1</div>
"#if 0" blocks are also folded, unless:<br>
<div class="helpExample"> :let c_no_if0_fold = 1</div>
<br>
If you notice highlighting errors while scrolling backwards, which are fixed<br>
when redrawing with <span class="Special">CTRL-L</span>, try setting the "c_minlines" internal variable<br>
to a larger number:<br>
<div class="helpExample"> :let c_minlines = 100</div>
This will make the syntax synchronization start 100 lines before the first<br>
displayed line. The default value is 50 (15 when c_no_if0 is set). The<br>
disadvantage of using a larger number is that redrawing can become slow.<br>
<br>
When using the "#if 0" / "#endif" comment highlighting, notice that this only<br>
works when the "#if 0" is within "c_minlines" from the top of the window. If<br>
you have a long "#if 0" construct it will not be highlighted correctly.<br>
<br>
To match extra items in comments, use the cCommentGroup cluster.<br>
Example:<br>
<div class="helpExample"> :au Syntax c call MyCadd()<br>
:function MyCadd()<br>
: syn keyword cMyItem contained Ni<br>
: syn cluster cCommentGroup add=cMyItem<br>
: hi link cMyItem Title<br>
:endfun</div>
<br>
ANSI constants will be highlighted with the "cConstant" group. This includes<br>
"NULL", "SIG_IGN" and others. But not "TRUE", for example, because this is<br>
not in the ANSI standard. If you find this confusing, remove the cConstant<br>
highlighting:<br>
<div class="helpExample"> :hi link cConstant NONE</div>
<br>
If you see '{' and '}' highlighted as an error where they are OK, reset the<br>
highlighting for cErrInParen and cErrInBracket.<br>
<br>
If you want to use folding in your C files, you can add these lines in a file<br>
in the "after" directory in <a class="Type" href="options.html#'runtimepath'">'runtimepath'</a>. For Unix this would be<br>
~/.vim/after/syntax/c.vim.<br>
<div class="helpExample"> syn sync fromstart<br>
set foldmethod=syntax</div>
<br>
<span class="Statement">CH </span><a class="Constant" href="syntax.html#ch.vim" name="ch.vim">ch.vim</a> <a class="Constant" href="syntax.html#ft-ch-syntax" name="ft-ch-syntax">ft-ch-syntax</a><br>
<br>
C/C++ interpreter. Ch has similar syntax highlighting to C and builds upon<br>
the C syntax file. See <a class="Identifier" href="syntax.html#c.vim">c.vim</a> for all the settings that are available for C.<br>
<br>
By setting a variable you can tell Vim to use Ch syntax for *.h files, instead<br>
of C or C++:<br>
<div class="helpExample"> :let ch_syntax_for_h = 1</div>
<br>
<br>
<span class="Statement">CHILL </span><a class="Constant" href="syntax.html#chill.vim" name="chill.vim">chill.vim</a> <a class="Constant" href="syntax.html#ft-chill-syntax" name="ft-chill-syntax">ft-chill-syntax</a><br>
<br>
Chill syntax highlighting is similar to C. See <a class="Identifier" href="syntax.html#c.vim">c.vim</a> for all the settings<br>
that are available. Additionally there is:<br>
<br>
chill_space_errors like c_space_errors<br>
chill_comment_string like c_comment_strings<br>
chill_minlines like c_minlines<br>
<br>
<br>
<span class="Statement">CHANGELOG </span><a class="Constant" href="syntax.html#changelog.vim" name="changelog.vim">changelog.vim</a> <a class="Constant" href="syntax.html#ft-changelog-syntax" name="ft-changelog-syntax">ft-changelog-syntax</a><br>
<br>
ChangeLog supports highlighting spaces at the start of a line.<br>
If you do not like this, add following line to your .vimrc:<br>
<div class="helpExample"> let g:changelog_spacing_errors = 0</div>
This works the next time you edit a changelog file. You can also use<br>
"b:changelog_spacing_errors" to set this per buffer (before loading the syntax<br>
file).<br>
<br>
You can change the highlighting used, e.g., to flag the spaces as an error:<br>
<div class="helpExample"> :hi link ChangelogError Error</div>
Or to avoid the highlighting:<br>
<div class="helpExample"> :hi link ChangelogError NONE</div>
This works immediately.<br>
<br>
<br>
<span class="Statement">CLOJURE </span><a class="Constant" href="syntax.html#ft-clojure-syntax" name="ft-clojure-syntax">ft-clojure-syntax</a><br>
<br>
The default syntax groups can be augmented through the<br>
<a class="Constant" href="syntax.html#g:clojure_syntax_keywords" name="g:clojure_syntax_keywords">g:clojure_syntax_keywords</a> and <a class="Constant" href="syntax.html#b:clojure_syntax_keywords" name="b:clojure_syntax_keywords">b:clojure_syntax_keywords</a> variables. The<br>
value should be a <a class="Identifier" href="eval.html#Dictionary">Dictionary</a> of syntax group names to a <a class="Identifier" href="eval.html#List">List</a> of custom<br>
identifiers:<br>
<br>
<div class="helpExample"> let g:clojure_syntax_keywords = {<br>
\ 'clojureMacro': ["defproject", "defcustom"],<br>
\ 'clojureFunc': ["string/join", "string/replace"]<br>
\ }</div>
<br>
Refer to the Clojure syntax script for valid syntax group names.<br>
<br>
If the <a class="Identifier" href="eval.html#buffer-variable">buffer-variable</a> <a class="Constant" href="syntax.html#b:clojure_syntax_without_core_keywords" name="b:clojure_syntax_without_core_keywords">b:clojure_syntax_without_core_keywords</a> is set, only<br>
language constants and special forms are matched.<br>
<br>
Setting <a class="Constant" href="syntax.html#g:clojure_fold" name="g:clojure_fold">g:clojure_fold</a> enables folding Clojure code via the syntax engine.<br>
Any list, vector, or map that extends over more than one line can be folded<br>
using the standard Vim <a class="Identifier" href="fold.html#fold-commands">fold-commands</a>.<br>
<br>
Please <span class="Todo">note</span> that this option does not work with scripts that redefine the<br>
bracket syntax regions, such as rainbow-parentheses plugins.<br>
<br>
This option is off by default.<br>
<br>
<div class="helpExample"> " Default<br>
let g:clojure_fold = 0</div>
<br>
<br>
<span class="Statement">COBOL </span><a class="Constant" href="syntax.html#cobol.vim" name="cobol.vim">cobol.vim</a> <a class="Constant" href="syntax.html#ft-cobol-syntax" name="ft-cobol-syntax">ft-cobol-syntax</a><br>
<br>
COBOL highlighting has different needs for legacy code than it does for fresh<br>
development. This is due to differences in what is being done (maintenance<br>
versus development) and other factors. To enable legacy code highlighting,<br>
add this line to your .vimrc:<br>
<div class="helpExample"> :let cobol_legacy_code = 1</div>
To disable it again, use this:<br>
<div class="helpExample"> :unlet cobol_legacy_code</div>
<br>
<br>
<span class="Statement">COLD FUSION </span><a class="Constant" href="syntax.html#coldfusion.vim" name="coldfusion.vim">coldfusion.vim</a> <a class="Constant" href="syntax.html#ft-coldfusion-syntax" name="ft-coldfusion-syntax">ft-coldfusion-syntax</a><br>
<br>
The ColdFusion has its own version of HTML comments. To turn on ColdFusion<br>
comment highlighting, add the following line to your startup file:<br>
<br>
<div class="helpExample"> :let html_wrong_comments = 1</div>
<br>
The ColdFusion syntax file is based on the HTML syntax file.<br>
<br>
<br>
<span class="Statement">CPP </span><a class="Constant" href="syntax.html#cpp.vim" name="cpp.vim">cpp.vim</a> <a class="Constant" href="syntax.html#ft-cpp-syntax" name="ft-cpp-syntax">ft-cpp-syntax</a><br>
<br>
Most of things are same as <a class="Identifier" href="syntax.html#ft-c-syntax">ft-c-syntax</a>.<br>
<br>
<span class="PreProc">Variable Highlight</span><br>
cpp_no_cpp11 don't highlight C++11 standard items<br>
cpp_no_cpp14 don't highlight C++14 standard items<br>
<br>
<br>
<span class="Statement">CSH </span><a class="Constant" href="syntax.html#csh.vim" name="csh.vim">csh.vim</a> <a class="Constant" href="syntax.html#ft-csh-syntax" name="ft-csh-syntax">ft-csh-syntax</a><br>
<br>
This covers the shell named "csh". <span class="Todo">Note</span> that on some systems tcsh is actually<br>
used.<br>
<br>
Detecting whether a file is csh or tcsh is notoriously hard. Some systems<br>
symlink /bin/csh to /bin/tcsh, making it almost impossible to distinguish<br>
between csh and tcsh. In case VIM guesses wrong you can set the<br>
"filetype_csh" variable. For using csh: <a class="Constant" href="syntax.html#g:filetype_csh" name="g:filetype_csh">g:filetype_csh</a><br>
<br>
<div class="helpExample"> :let g:filetype_csh = "csh"</div>
<br>
For using tcsh:<br>
<br>
<div class="helpExample"> :let g:filetype_csh = "tcsh"</div>
<br>
Any script with a tcsh extension or a standard tcsh filename (.tcshrc,<br>
tcsh.tcshrc, tcsh.login) will have filetype tcsh. All other tcsh/csh scripts<br>
will be classified as tcsh, UNLESS the "filetype_csh" variable exists. If the<br>
"filetype_csh" variable exists, the filetype will be set to the value of the<br>
variable.<br>
<br>
<br>
<span class="Statement">CYNLIB </span><a class="Constant" href="syntax.html#cynlib.vim" name="cynlib.vim">cynlib.vim</a> <a class="Constant" href="syntax.html#ft-cynlib-syntax" name="ft-cynlib-syntax">ft-cynlib-syntax</a><br>
<br>
Cynlib files are C++ files that use the Cynlib class library to enable<br>
hardware modelling and simulation using C++. Typically Cynlib files have a .cc<br>
or a .cpp extension, which makes it very difficult to distinguish them from a<br>
normal C++ file. Thus, to enable Cynlib highlighting for .cc files, add this<br>
line to your .vimrc file:<br>
<br>
<div class="helpExample"> :let cynlib_cyntax_for_cc=1</div>
<br>
Similarly for cpp files (this extension is only usually used in Windows)<br>
<br>
<div class="helpExample"> :let cynlib_cyntax_for_cpp=1</div>
<br>
To disable these again, use this:<br>
<br>
<div class="helpExample"> :unlet cynlib_cyntax_for_cc<br>
:unlet cynlib_cyntax_for_cpp</div>
<br>
<br>
<span class="Statement">CWEB </span><a class="Constant" href="syntax.html#cweb.vim" name="cweb.vim">cweb.vim</a> <a class="Constant" href="syntax.html#ft-cweb-syntax" name="ft-cweb-syntax">ft-cweb-syntax</a><br>
<br>
Files matching "*.w" could be Progress or cweb. If the automatic detection<br>
doesn't work for you, or you don't edit Progress at all, use this in your<br>
startup vimrc:<br>
<div class="helpExample"> :let filetype_w = "cweb"</div>
<br>
<br>
<span class="Statement">DESKTOP </span><a class="Constant" href="syntax.html#desktop.vim" name="desktop.vim">desktop.vim</a> <a class="Constant" href="syntax.html#ft-desktop-syntax" name="ft-desktop-syntax">ft-desktop-syntax</a><br>
<br>
Primary goal of this syntax file is to highlight .desktop and .directory files<br>
according to freedesktop.org standard:<br>
<span class="Constant"><a href="http://standards.freedesktop.org/desktop-entry-spec/latest/">http://standards.freedesktop.org/desktop-entry-spec/latest/</a></span><br>
But actually almost none implements this standard fully. Thus it will<br>
highlight all Unix ini files. But you can force strict highlighting according<br>
to standard by placing this in your vimrc file:<br>
<div class="helpExample"> :let enforce_freedesktop_standard = 1</div>
<br>
<br>
<span class="Statement">DIFF </span><a class="Constant" href="syntax.html#diff.vim" name="diff.vim">diff.vim</a><br>
<br>
The diff highlighting normally finds translated headers. This can be slow if<br>
there are very long lines in the file. To disable translations:<br>
<br>
<div class="helpExample"> :let diff_translations = 0</div>
<br>
Also see <a class="Identifier" href="diff.html#diff-slow">diff-slow</a>.<br>
<br>
<br>
<span class="Statement">DIRCOLORS </span><a class="Constant" href="syntax.html#dircolors.vim" name="dircolors.vim">dircolors.vim</a> <a class="Constant" href="syntax.html#ft-dircolors-syntax" name="ft-dircolors-syntax">ft-dircolors-syntax</a><br>
<br>
The dircolors utility highlighting definition has one option. It exists to<br>
provide compatibility with the Slackware GNU/Linux distributions version of<br>
the command. It adds a few keywords that are generally ignored by most<br>
versions. On Slackware systems, however, the utility accepts the keywords and<br>
uses them for processing. To enable the Slackware keywords add the following<br>
line to your startup file:<br>
<div class="helpExample"> let dircolors_is_slackware = 1</div>
<br>
<br>
<span class="Statement">DOCBOOK </span><a class="Constant" href="syntax.html#docbk.vim" name="docbk.vim">docbk.vim</a> <a class="Constant" href="syntax.html#ft-docbk-syntax" name="ft-docbk-syntax">ft-docbk-syntax</a> <a class="Constant" href="syntax.html#docbook" name="docbook">docbook</a><br>
<span class="Statement">DOCBOOK XML </span><a class="Constant" href="syntax.html#docbkxml.vim" name="docbkxml.vim">docbkxml.vim</a> <a class="Constant" href="syntax.html#ft-docbkxml-syntax" name="ft-docbkxml-syntax">ft-docbkxml-syntax</a><br>
<span class="Statement">DOCBOOK SGML </span><a class="Constant" href="syntax.html#docbksgml.vim" name="docbksgml.vim">docbksgml.vim</a> <a class="Constant" href="syntax.html#ft-docbksgml-syntax" name="ft-docbksgml-syntax">ft-docbksgml-syntax</a><br>
<br>
There are two types of DocBook files: SGML and XML. To specify what type you<br>
are using the "b:docbk_type" variable should be set. Vim does this for you<br>
automatically if it can recognize the type. When Vim can't guess it the type<br>
defaults to XML.<br>
You can set the type manually:<br>
<div class="helpExample"> :let docbk_type = "sgml"</div>
or:<br>
<div class="helpExample"> :let docbk_type = "xml"</div>
You need to do this before loading the syntax file, which is complicated.<br>
Simpler is setting the filetype to "docbkxml" or "docbksgml":<br>
<div class="helpExample"> :set filetype=docbksgml</div>
or:<br>
<div class="helpExample"> :set filetype=docbkxml</div>
<br>
You can specify the DocBook version:<br>
<div class="helpExample"> :let docbk_ver = 3</div>
When not set 4 is used.<br>
<br>
<br>
<span class="Statement">DOSBATCH </span><a class="Constant" href="syntax.html#dosbatch.vim" name="dosbatch.vim">dosbatch.vim</a> <a class="Constant" href="syntax.html#ft-dosbatch-syntax" name="ft-dosbatch-syntax">ft-dosbatch-syntax</a><br>
<br>
There is one option with highlighting DOS batch files. This covers new<br>
extensions to the Command Interpreter introduced with Windows 2000 and<br>
is controlled by the variable dosbatch_cmdextversion. For Windows NT<br>
this should have the value 1, and for Windows 2000 it should be 2.<br>
Select the version you want with the following line:<br>
<br>
<div class="helpExample"> :let dosbatch_cmdextversion = 1</div>
<br>
If this variable is not defined it defaults to a value of 2 to support<br>
Windows 2000.<br>
<br>
A second option covers whether *.btm files should be detected as type<br>
"dosbatch" (MS-DOS batch files) or type "btm" (4DOS batch files). The latter<br>
is used by default. You may select the former with the following line:<br>
<br>
<div class="helpExample"> :let g:dosbatch_syntax_for_btm = 1</div>
<br>
If this variable is undefined or zero, btm syntax is selected.<br>
<br>
<br>
<span class="Statement">DOXYGEN </span><a class="Constant" href="syntax.html#doxygen.vim" name="doxygen.vim">doxygen.vim</a> <a class="Constant" href="syntax.html#doxygen-syntax" name="doxygen-syntax">doxygen-syntax</a><br>
<br>
Doxygen generates code documentation using a special documentation format<br>
(similar to Javadoc). This syntax script adds doxygen highlighting to c, cpp,<br>
idl and php files, and should also work with java.<br>
<br>
There are a few of ways to turn on doxygen formatting. It can be done<br>
explicitly or in a modeline by appending '.doxygen' to the syntax of the file.<br>
Example:<br>
<div class="helpExample"> :set syntax=c.doxygen</div>
or<br>
<div class="helpExample"> // vim:syntax=c.doxygen</div>
<br>
It can also be done automatically for C, C++, C#, IDL and PHP files by setting<br>
the global or buffer-local variable load_doxygen_syntax. This is done by<br>
adding the following to your .vimrc.<br>
<div class="helpExample"> :let g:load_doxygen_syntax=1</div>
<br>
There are a couple of variables that have an effect on syntax highlighting, and<br>
are to do with non-standard highlighting options.<br>
<br>
<span class="PreProc">Variable Default Effect</span><br>
g:doxygen_enhanced_color<br>
g:doxygen_enhanced_colour 0 Use non-standard highlighting for<br>
doxygen comments.<br>
<br>
doxygen_my_rendering 0 Disable rendering of HTML bold, italic<br>
and html_my_rendering underline.<br>
<br>
doxygen_javadoc_autobrief 1 Set to 0 to disable javadoc autobrief<br>
colour highlighting.<br>
<br>
doxygen_end_punctuation '[.]' Set to regexp match for the ending<br>
punctuation of brief<br>
<br>
There are also some hilight groups worth mentioning as they can be useful in<br>
configuration.<br>
<br>
<span class="PreProc">Highlight Effect</span><br>
doxygenErrorComment The colour of an end-comment when missing<br>
punctuation in a code, verbatim or dot section<br>
doxygenLinkError The colour of an end-comment when missing the<br>
\endlink from a \link section.<br>
<br>
<br>
<span class="Statement">DTD </span><a class="Constant" href="syntax.html#dtd.vim" name="dtd.vim">dtd.vim</a> <a class="Constant" href="syntax.html#ft-dtd-syntax" name="ft-dtd-syntax">ft-dtd-syntax</a><br>
<br>
The DTD syntax highlighting is case sensitive by default. To disable<br>
case-sensitive highlighting, add the following line to your startup file:<br>
<br>
<div class="helpExample"> :let dtd_ignore_case=1</div>
<br>
The DTD syntax file will highlight unknown tags as errors. If<br>
this is annoying, it can be turned off by setting:<br>
<br>
<div class="helpExample"> :let dtd_no_tag_errors=1</div>
<br>
before sourcing the dtd.vim syntax file.<br>
Parameter entity names are highlighted in the definition using the<br>
'Type' highlighting group and 'Comment' for punctuation and '%'.<br>
Parameter entity instances are highlighted using the 'Constant'<br>
highlighting group and the 'Type' highlighting group for the<br>
delimiters % and ;. This can be turned off by setting:<br>
<br>
<div class="helpExample"> :let dtd_no_param_entities=1</div>
<br>
The DTD syntax file is also included by xml.vim to highlight included dtd's.<br>
<br>
<br>
<span class="Statement">EIFFEL </span><a class="Constant" href="syntax.html#eiffel.vim" name="eiffel.vim">eiffel.vim</a> <a class="Constant" href="syntax.html#ft-eiffel-syntax" name="ft-eiffel-syntax">ft-eiffel-syntax</a><br>
<br>
While Eiffel is not case-sensitive, its style guidelines are, and the<br>
syntax highlighting file encourages their use. This also allows to<br>
highlight class names differently. If you want to disable case-sensitive<br>
highlighting, add the following line to your startup file:<br>
<br>
<div class="helpExample"> :let eiffel_ignore_case=1</div>
<br>
Case still matters for class names and TODO marks in comments.<br>
<br>
Conversely, for even stricter checks, add one of the following lines:<br>
<br>
<div class="helpExample"> :let eiffel_strict=1<br>
:let eiffel_pedantic=1</div>
<br>
Setting eiffel_strict will only catch improper capitalization for the<br>
five predefined words "Current", "Void", "Result", "Precursor", and<br>
"NONE", to warn against their accidental use as feature or class names.<br>
<br>
Setting eiffel_pedantic will enforce adherence to the Eiffel style<br>
guidelines fairly rigorously (like arbitrary mixes of upper- and<br>
lowercase letters as well as outdated ways to capitalize keywords).<br>
<br>
If you want to use the lower-case version of "Current", "Void",<br>
"Result", and "Precursor", you can use<br>
<br>
<div class="helpExample"> :let eiffel_lower_case_predef=1</div>
<br>
instead of completely turning case-sensitive highlighting off.<br>
<br>
Support for ISE's proposed new creation syntax that is already<br>
experimentally handled by some compilers can be enabled by:<br>
<br>
<div class="helpExample"> :let eiffel_ise=1</div>
<br>
Finally, some vendors support hexadecimal constants. To handle them, add<br>
<br>
<div class="helpExample"> :let eiffel_hex_constants=1</div>
<br>
to your startup file.<br>
<br>
<br>
<span class="Statement">EUPHORIA </span><a class="Constant" href="syntax.html#euphoria3.vim" name="euphoria3.vim">euphoria3.vim</a> <a class="Constant" href="syntax.html#euphoria4.vim" name="euphoria4.vim">euphoria4.vim</a> <a class="Constant" href="syntax.html#ft-euphoria-syntax" name="ft-euphoria-syntax">ft-euphoria-syntax</a><br>
<br>
Two syntax highlighting files exists for Euphoria. One for Euphoria <br>
version 3.1.1, which is the default syntax highlighting file, and one for <br>
Euphoria version 4.0.5 or later.<br>
<br>
Euphoria version 3.1.1 (<span class="Constant"><a href="http://www.rapideuphoria.com/">http://www.rapideuphoria.com/</a></span>) is still necessary <br>
for developing applications for the DOS platform, which Euphoria version 4 <br>
(<span class="Constant"><a href="http://www.openeuphoria.org/">http://www.openeuphoria.org/</a></span>) does not support.<br>
<br>
The following file extensions are auto-detected as Euphoria file type: <br>
<br>
*.e, *.eu, *.ew, *.ex, *.exu, *.exw<br>
*.E, *.EU, *.EW, *.EX, *.EXU, *.EXW<br>
<br>
To select syntax highlighting file for Euphoria, as well as for <br>
auto-detecting the *.e and *.E file extensions as Euphoria file type,<br>
add the following line to your startup file:<br>
<br>
<div class="helpExample"> :let filetype_euphoria="euphoria3"</div>
<br>
<div class="helpExample"> or </div>
<br>
<div class="helpExample"> :let filetype_euphoria="euphoria4"</div>
<br>
<br>
<span class="Statement">ERLANG </span><a class="Constant" href="syntax.html#erlang.vim" name="erlang.vim">erlang.vim</a> <a class="Constant" href="syntax.html#ft-erlang-syntax" name="ft-erlang-syntax">ft-erlang-syntax</a><br>
<br>
Erlang is a functional programming language developed by Ericsson. Files with<br>
the following extensions are recognized as Erlang files: erl, hrl, yaws.<br>
<br>
The BIFs (built-in functions) are highlighted by default. To disable this,<br>
put the following line in your vimrc:<br>
<br>
<div class="helpExample"> :let g:erlang_highlight_bifs = 0</div>
<br>
To enable highlighting some special atoms, put this in your vimrc:<br>
<br>
<div class="helpExample"> :let g:erlang_highlight_special_atoms = 1</div>
<br>
<br>
<span class="Statement">FLEXWIKI </span><a class="Constant" href="syntax.html#flexwiki.vim" name="flexwiki.vim">flexwiki.vim</a> <a class="Constant" href="syntax.html#ft-flexwiki-syntax" name="ft-flexwiki-syntax">ft-flexwiki-syntax</a><br>
<br>
FlexWiki is an ASP.NET-based wiki package available at <span class="Constant"><a href="http://www.flexwiki.com">http://www.flexwiki.com</a></span><br>
<span class="Todo">NOTE</span>: this site currently doesn't work, on Wikipedia is mentioned that<br>
development stopped in 2009.<br>
<br>
Syntax highlighting is available for the most common elements of FlexWiki<br>
syntax. The associated ftplugin script sets some buffer-local options to make<br>
editing FlexWiki pages more convenient. FlexWiki considers a newline as the<br>
start of a new paragraph, so the ftplugin sets <a class="Type" href="options.html#'tw'">'tw'</a>=0 (unlimited line length),<br>
<a class="Type" href="options.html#'wrap'">'wrap'</a> (wrap long lines instead of using horizontal scrolling), <a class="Type" href="options.html#'linebreak'">'linebreak'</a><br>
(to wrap at a character in <a class="Type" href="options.html#'breakat'">'breakat'</a> instead of at the last char on screen),<br>
and so on. It also includes some keymaps that are disabled by default.<br>
<br>
If you want to enable the keymaps that make "j" and "k" and the cursor keys<br>
move up and down by display lines, add this to your .vimrc:<br>
<div class="helpExample"> :let flexwiki_maps = 1</div>
<br>
<br>
<span class="Statement">FORM </span><a class="Constant" href="syntax.html#form.vim" name="form.vim">form.vim</a> <a class="Constant" href="syntax.html#ft-form-syntax" name="ft-form-syntax">ft-form-syntax</a><br>
<br>
The coloring scheme for syntax elements in the FORM file uses the default<br>
modes Conditional, Number, Statement, Comment, PreProc, Type, and String,<br>
following the language specifications in 'Symbolic Manipulation with FORM' by<br>
J.A.M. Vermaseren, CAN, Netherlands, 1991.<br>
<br>
If you want include your own changes to the default colors, you have to<br>
redefine the following syntax groups:<br>
<br>
- formConditional<br>
- formNumber<br>
- formStatement<br>
- formHeaderStatement<br>
- formComment<br>
- formPreProc<br>
- formDirective<br>
- formType<br>
- formString<br>
<br>
<span class="Todo">Note</span> that the form.vim syntax file implements FORM preprocessor commands and<br>
directives per default in the same syntax group.<br>
<br>
A predefined enhanced color mode for FORM is available to distinguish between<br>
header statements and statements in the body of a FORM program. To activate<br>
this mode define the following variable in your vimrc file<br>
<br>
<div class="helpExample"> :let form_enhanced_color=1</div>
<br>
The enhanced mode also takes advantage of additional color features for a dark<br>
gvim display. Here, statements are colored LightYellow instead of Yellow, and<br>
conditionals are LightBlue for better distinction.<br>
<br>
<br>
<span class="Statement">FORTRAN </span><a class="Constant" href="syntax.html#fortran.vim" name="fortran.vim">fortran.vim</a> <a class="Constant" href="syntax.html#ft-fortran-syntax" name="ft-fortran-syntax">ft-fortran-syntax</a><br>
<br>
<span class="PreProc">Default highlighting and dialect</span><br>
Highlighting appropriate for Fortran 2008 is used by default. This choice<br>
should be appropriate for most users most of the time because Fortran 2008 is<br>
almost a superset of previous versions (Fortran 2003, 95, 90, and 77).<br>
<br>
<span class="PreProc">Fortran source code form</span><br>
Fortran code can be in either fixed or free source form. <span class="Todo">Note</span> that the<br>
syntax highlighting will not be correct if the form is incorrectly set.<br>
<br>
When you create a new fortran file, the syntax script assumes fixed source<br>
form. If you always use free source form, then<br>
<div class="helpExample"> :let fortran_free_source=1</div>
in your .vimrc prior to the :syntax on command. If you always use fixed source<br>
form, then<br>
<div class="helpExample"> :let fortran_fixed_source=1</div>
in your .vimrc prior to the :syntax on command.<br>
<br>
If the form of the source code depends, in a non-standard way, upon the file<br>
extension, then it is most convenient to set fortran_free_source in a ftplugin<br>
file. For more information on ftplugin files, see <a class="Identifier" href="usr_41.html#ftplugin">ftplugin</a>. <span class="Todo">Note</span> that this<br>
will work only if the "filetype plugin indent on" command precedes the "syntax<br>
on" command in your .vimrc file.<br>
<br>
When you edit an existing fortran file, the syntax script will assume free<br>
source form if the fortran_free_source variable has been set, and assumes<br>
fixed source form if the fortran_fixed_source variable has been set. If<br>
neither of these variables have been set, the syntax script attempts to<br>
determine which source form has been used by examining the file extension<br>
using conventions common to the ifort, gfortran, Cray, NAG, and PathScale<br>
compilers (.f, .for, .f77 for fixed-source, .f90, .f95, .f03, .f08 for<br>
free-source). If none of this works, then the script examines the first five<br>
columns of the first 500 lines of your file. If no signs of free source form<br>
are detected, then the file is assumed to be in fixed source form. The<br>
algorithm should work in the vast majority of cases. In some cases, such as a<br>
file that begins with 500 or more full-line comments, the script may<br>
incorrectly decide that the fortran code is in fixed form. If that happens,<br>
just add a non-comment statement beginning anywhere in the first five columns<br>
of the first twenty-five lines, save (:w) and then reload (:e!) the file.<br>
<br>
<span class="PreProc">Tabs in fortran files</span><br>
Tabs are not recognized by the Fortran standards. Tabs are not a good idea in<br>
fixed format fortran source code which requires fixed column boundaries.<br>
Therefore, tabs are marked as errors. Nevertheless, some programmers like<br>
using tabs. If your fortran files contain tabs, then you should set the<br>
variable fortran_have_tabs in your .vimrc with a command such as<br>
<div class="helpExample"> :let fortran_have_tabs=1</div>
placed prior to the :syntax on command. Unfortunately, the use of tabs will<br>
mean that the syntax file will not be able to detect incorrect margins.<br>
<br>
<span class="PreProc">Syntax folding of fortran files</span><br>
If you wish to use foldmethod=syntax, then you must first set the variable<br>
fortran_fold with a command such as<br>
<div class="helpExample"> :let fortran_fold=1</div>
to instruct the syntax script to define fold regions for program units, that<br>
is main programs starting with a program statement, subroutines, function<br>
subprograms, block data subprograms, interface blocks, and modules. If you<br>
also set the variable fortran_fold_conditionals with a command such as<br>
<div class="helpExample"> :let fortran_fold_conditionals=1</div>
then fold regions will also be defined for do loops, if blocks, and select<br>
case constructs. If you also set the variable<br>
fortran_fold_multilinecomments with a command such as<br>
<div class="helpExample"> :let fortran_fold_multilinecomments=1</div>
then fold regions will also be defined for three or more consecutive comment<br>
lines. <span class="Todo">Note</span> that defining fold regions can be slow for large files.<br>
<br>
If fortran_fold, and possibly fortran_fold_conditionals and/or<br>
fortran_fold_multilinecomments, have been set, then vim will fold your file if<br>
you set foldmethod=syntax. Comments or blank lines placed between two program<br>
units are not folded because they are seen as not belonging to any program<br>
unit.<br>
<br>
<span class="PreProc">More precise fortran syntax</span><br>
If you set the variable fortran_more_precise with a command such as<br>
<div class="helpExample"> :let fortran_more_precise=1</div>
then the syntax coloring will be more precise but slower. In particular,<br>
statement labels used in do, goto and arithmetic if statements will be<br>
recognized, as will construct names at the end of a do, if, select or forall<br>
construct.<br>
<br>
<span class="PreProc">Non-default fortran dialects</span><br>
The syntax script supports two Fortran dialects: f08 and F. You will probably<br>
find the default highlighting (f08) satisfactory. A few legacy constructs<br>
deleted or declared obsolescent in the 2008 standard are highlighted as todo<br>
items.<br>
<br>
If you use F, the advantage of setting the dialect appropriately is that<br>
other legacy features excluded from F will be highlighted as todo items and<br>
that free source form will be assumed.<br>
<br>
The dialect can be selected in various ways. If all your fortran files use<br>
the same dialect, set the global variable fortran_dialect in your .vimrc prior<br>
to your syntax on statement. The case-sensitive, permissible values of<br>
fortran_dialect are "f08" or "F". Invalid values of fortran_dialect are<br>
ignored.<br>
<br>
If the dialect depends upon the file extension, then it is most convenient to<br>
set a buffer-local variable in a ftplugin file. For more information on<br>
ftplugin files, see <a class="Identifier" href="usr_41.html#ftplugin">ftplugin</a>. For example, if all your fortran files with<br>
an .f90 extension are written in the F subset, your ftplugin file should<br>
contain the code<br>
<div class="helpExample"> let s:extfname = expand("%:e")<br>
if s:extfname ==? "f90"<br>
let b:fortran_dialect="F"<br>
else<br>
unlet! b:fortran_dialect<br>
endif</div>
<span class="Todo">Note</span> that this will work only if the "filetype plugin indent on" command<br>
precedes the "syntax on" command in your .vimrc file.<br>
<br>
Finer control is necessary if the file extension does not uniquely identify<br>
the dialect. You can override the default dialect, on a file-by-file basis,<br>
by including a comment with the directive "fortran_dialect=xx" (where xx=F or<br>
f08) in one of the first three lines in your file. For example, your older .f<br>
files may be legacy code but your newer ones may be F codes, and you would<br>
identify the latter by including in the first three lines of those files a<br>
Fortran comment of the form<br>
<div class="helpExample"> ! fortran_dialect=F</div>
<br>
For previous versions of the syntax, you may have set fortran_dialect to the<br>
now-obsolete values "f77", "f90", "f95", or "elf". Such settings will be<br>
silently handled as "f08". Users of "elf" may wish to experiment with "F"<br>
instead.<br>
<br>
The syntax/fortran.vim script contains embedded comments that tell you how to<br>
comment and/or uncomment some lines to (a) activate recognition of some<br>
non-standard, vendor-supplied intrinsics and (b) to prevent features deleted<br>
or declared obsolescent in the 2008 standard from being highlighted as todo<br>
items.<br>
<br>
<span class="PreProc">Limitations</span><br>
Parenthesis checking does not catch too few closing parentheses. Hollerith<br>
strings are not recognized. Some keywords may be highlighted incorrectly<br>
because Fortran90 has no reserved words.<br>
<br>
For further information related to fortran, see <a class="Identifier" href="indent.html#ft-fortran-indent">ft-fortran-indent</a> and<br>
<a class="Identifier" href="filetype.html#ft-fortran-plugin">ft-fortran-plugin</a>.<br>
<br>
<br>
<span class="Statement">FVWM CONFIGURATION FILES </span><a class="Constant" href="syntax.html#fvwm.vim" name="fvwm.vim">fvwm.vim</a> <a class="Constant" href="syntax.html#ft-fvwm-syntax" name="ft-fvwm-syntax">ft-fvwm-syntax</a><br>
<br>
In order for Vim to recognize Fvwm configuration files that do not match<br>
the patterns <a class="Constant" href="syntax.html#fvwmrc" name="fvwmrc">fvwmrc</a> or <a class="Constant" href="syntax.html#fvwm2rc" name="fvwm2rc">fvwm2rc</a> , you must put additional patterns<br>
appropriate to your system in your myfiletypes.vim file. For these<br>
patterns, you must set the variable "b:fvwm_version" to the major version<br>
number of Fvwm, and the <a class="Type" href="options.html#'filetype'">'filetype'</a> option to fvwm.<br>
<br>
For example, to make Vim identify all files in /etc/X11/fvwm2/<br>
as Fvwm2 configuration files, add the following:<br>
<br>
<div class="helpExample"> :au! BufNewFile,BufRead /etc/X11/fvwm2/* let b:fvwm_version = 2 |<br>
\ set filetype=fvwm</div>
<br>
If you'd like Vim to highlight all valid color names, tell it where to<br>
find the color database (rgb.txt) on your system. Do this by setting<br>
"rgb_file" to its location. Assuming your color database is located<br>
in /usr/X11/lib/X11/, you should add the line<br>
<br>
<div class="helpExample"> :let rgb_file = "/usr/X11/lib/X11/rgb.txt"</div>
<br>
to your .vimrc file.<br>
<br>
<br>
<span class="Statement">GSP </span><a class="Constant" href="syntax.html#gsp.vim" name="gsp.vim">gsp.vim</a> <a class="Constant" href="syntax.html#ft-gsp-syntax" name="ft-gsp-syntax">ft-gsp-syntax</a><br>
<br>
The default coloring style for GSP pages is defined by <a class="Identifier" href="syntax.html#html.vim">html.vim</a>, and<br>
the coloring for java code (within java tags or inline between backticks)<br>
is defined by <a class="Identifier" href="syntax.html#java.vim">java.vim</a>. The following HTML groups defined in <a class="Identifier" href="syntax.html#html.vim">html.vim</a><br>
are redefined to incorporate and highlight inline java code:<br>
<br>
htmlString<br>
htmlValue<br>
htmlEndTag<br>
htmlTag<br>
htmlTagN<br>
<br>
Highlighting should look fine most of the places where you'd see inline<br>
java code, but in some special cases it may not. To add another HTML<br>
group where you will have inline java code where it does not highlight<br>
correctly, just copy the line you want from <a class="Identifier" href="syntax.html#html.vim">html.vim</a> and add gspJava<br>
to the contains clause.<br>
<br>
The backticks for inline java are highlighted according to the htmlError<br>
group to make them easier to see.<br>
<br>
<br>
<span class="Statement">GROFF </span><a class="Constant" href="syntax.html#groff.vim" name="groff.vim">groff.vim</a> <a class="Constant" href="syntax.html#ft-groff-syntax" name="ft-groff-syntax">ft-groff-syntax</a><br>
<br>
The groff syntax file is a wrapper for <a class="Identifier" href="syntax.html#nroff.vim">nroff.vim</a>, see the notes<br>
under that heading for examples of use and configuration. The purpose<br>
of this wrapper is to set up groff syntax extensions by setting the<br>
filetype from a <a class="Identifier" href="options.html#modeline">modeline</a> or in a personal filetype definitions file<br>
(see <a class="Identifier" href="filetype.html">filetype.txt</a>).<br>
<br>
<br>
<span class="Statement">HASKELL </span><a class="Constant" href="syntax.html#haskell.vim" name="haskell.vim">haskell.vim</a> <a class="Constant" href="syntax.html#lhaskell.vim" name="lhaskell.vim">lhaskell.vim</a> <a class="Constant" href="syntax.html#ft-haskell-syntax" name="ft-haskell-syntax">ft-haskell-syntax</a><br>
<br>
The Haskell syntax files support plain Haskell code as well as literate<br>
Haskell code, the latter in both Bird style and TeX style. The Haskell<br>
syntax highlighting will also highlight C preprocessor directives.<br>
<br>
If you want to highlight delimiter characters (useful if you have a<br>
light-coloured background), add to your .vimrc:<br>
<div class="helpExample"> :let hs_highlight_delimiters = 1</div>
To treat True and False as keywords as opposed to ordinary identifiers,<br>
add:<br>
<div class="helpExample"> :let hs_highlight_boolean = 1</div>
To also treat the names of primitive types as keywords:<br>
<div class="helpExample"> :let hs_highlight_types = 1</div>
And to treat the names of even more relatively common types as keywords:<br>
<div class="helpExample"> :let hs_highlight_more_types = 1</div>
If you want to highlight the names of debugging functions, put in<br>
your .vimrc:<br>
<div class="helpExample"> :let hs_highlight_debug = 1</div>
<br>
The Haskell syntax highlighting also highlights C preprocessor<br>
directives, and flags lines that start with # but are not valid<br>
directives as erroneous. This interferes with Haskell's syntax for<br>
operators, as they may start with #. If you want to highlight those<br>
as operators as opposed to errors, put in your .vimrc:<br>
<div class="helpExample"> :let hs_allow_hash_operator = 1</div>
<br>
The syntax highlighting for literate Haskell code will try to<br>
automatically guess whether your literate Haskell code contains<br>
TeX markup or not, and correspondingly highlight TeX constructs<br>
or nothing at all. You can override this globally by putting<br>
in your .vimrc<br>
<div class="helpExample"> :let lhs_markup = none</div>
for no highlighting at all, or<br>
<div class="helpExample"> :let lhs_markup = tex</div>
to force the highlighting to always try to highlight TeX markup.<br>
For more flexibility, you may also use buffer local versions of<br>
this variable, so e.g.<br>
<div class="helpExample"> :let b:lhs_markup = tex</div>
will force TeX highlighting for a particular buffer. It has to be<br>
set before turning syntax highlighting on for the buffer or<br>
loading a file.<br>
<br>
<br>
<span class="Statement">HTML </span><a class="Constant" href="syntax.html#html.vim" name="html.vim">html.vim</a> <a class="Constant" href="syntax.html#ft-html-syntax" name="ft-html-syntax">ft-html-syntax</a><br>
<br>
The coloring scheme for tags in the HTML file works as follows.<br>
<br>
The <> of opening tags are colored differently than the </> of a closing tag.<br>
This is on purpose! For opening tags the 'Function' color is used, while for<br>
closing tags the 'Type' color is used (See syntax.vim to check how those are<br>
defined for you)<br>
<br>
Known tag names are colored the same way as statements in C. Unknown tag<br>
names are colored with the same color as the <> or </> respectively which<br>
makes it easy to spot errors<br>
<br>
<span class="Todo">Note</span> that the same is true for argument (or attribute) names. Known attribute<br>
names are colored differently than unknown ones.<br>
<br>
Some HTML tags are used to change the rendering of text. The following tags<br>
are recognized by the html.vim syntax coloring file and change the way normal<br>
text is shown: <span class="Special"><B></span> <span class="Special"><I></span> <span class="Special"><U></span> <span class="Special"><EM></span> <span class="Special"><STRONG></span> (<span class="Special"><EM></span> is used as an alias for <span class="Special"><I></span>,<br>
while <span class="Special"><STRONG></span> as an alias for <span class="Special"><B></span>), <span class="Special"><H1></span> - <span class="Special"><H6></span>, <span class="Special"><HEAD></span>, <span class="Special"><TITLE></span> and <span class="Special"><A></span>, but<br>
only if used as a link (that is, it must include a href as in<br>
<A href="somefile.html">).<br>
<br>
If you want to change how such text is rendered, you must redefine the<br>
following syntax groups:<br>
<br>
- htmlBold<br>
- htmlBoldUnderline<br>
- htmlBoldUnderlineItalic<br>
- htmlUnderline<br>
- htmlUnderlineItalic<br>
- htmlItalic<br>
- htmlTitle for titles<br>
- htmlH1 - htmlH6 for headings<br>
<br>
To make this redefinition work you must redefine them all with the exception<br>
of the last two (htmlTitle and htmlH[1-6], which are optional) and define the<br>
following variable in your vimrc (this is due to the order in which the files<br>
are read during initialization)<br>
<div class="helpExample"> :let html_my_rendering=1</div>
<br>
If you'd like to see an example download mysyntax.vim at<br>
<span class="Constant"><a href="http://www.fleiner.com/vim/download.html">http://www.fleiner.com/vim/download.html</a></span><br>
<br>
You can also disable this rendering by adding the following line to your<br>
vimrc file:<br>
<div class="helpExample"> :let html_no_rendering=1</div>
<br>
HTML comments are rather special (see an HTML reference document for the<br>
details), and the syntax coloring scheme will highlight all errors.<br>
However, if you prefer to use the wrong style (starts with <!-- and<br>
ends with -->) you can define<br>
<div class="helpExample"> :let html_wrong_comments=1</div>
<br>
JavaScript and Visual Basic embedded inside HTML documents are highlighted as<br>
'Special' with statements, comments, strings and so on colored as in standard<br>
programming languages. <span class="Todo">Note</span> that only JavaScript and Visual Basic are currently<br>
supported, no other scripting language has been added yet.<br>
<br>
Embedded and inlined cascading style sheets (CSS) are highlighted too.<br>
<br>
There are several html preprocessor languages out there. html.vim has been<br>
written such that it should be trivial to include it. To do so add the<br>
following two lines to the syntax coloring file for that language<br>
(the example comes from the asp.vim file):<br>
<br>
runtime! syntax/html.vim<br>
syn cluster htmlPreproc add=asp<br>
<br>
Now you just need to make sure that you add all regions that contain<br>
the preprocessor language to the cluster htmlPreproc.<br>
<br>
<br>
HTML/OS (by Aestiva) <a class="Constant" href="syntax.html#htmlos.vim" name="htmlos.vim">htmlos.vim</a> <a class="Constant" href="syntax.html#ft-htmlos-syntax" name="ft-htmlos-syntax">ft-htmlos-syntax</a><br>
<br>
The coloring scheme for HTML/OS works as follows:<br>
<br>
Functions and variable names are the same color by default, because VIM<br>
doesn't specify different colors for Functions and Identifiers. To change<br>
this (which is recommended if you want function names to be recognizable in a<br>
different color) you need to add the following line to either your ~/.vimrc:<br>
<div class="helpExample"> :hi Function term=underline cterm=bold ctermfg=LightGray</div>
<br>
Of course, the ctermfg can be a different color if you choose.<br>
<br>
Another issues that HTML/OS runs into is that there is no special filetype to<br>
signify that it is a file with HTML/OS coding. You can change this by opening<br>
a file and turning on HTML/OS syntax by doing the following:<br>
<div class="helpExample"> :set syntax=htmlos</div>
<br>
Lastly, it should be noted that the opening and closing characters to begin a<br>
block of HTML/OS code can either be << or [[ and >> or ]], respectively.<br>
<br>
<br>
<span class="Statement">IA64 </span><a class="Constant" href="syntax.html#ia64.vim" name="ia64.vim">ia64.vim</a> <a class="Constant" href="syntax.html#intel-itanium" name="intel-itanium">intel-itanium</a> <a class="Constant" href="syntax.html#ft-ia64-syntax" name="ft-ia64-syntax">ft-ia64-syntax</a><br>
<br>
Highlighting for the Intel Itanium 64 assembly language. See <a class="Identifier" href="syntax.html#asm.vim">asm.vim</a> for<br>
how to recognize this filetype.<br>
<br>
To have *.inc files be recognized as IA64, add this to your .vimrc file:<br>
<div class="helpExample"> :let g:filetype_inc = "ia64"</div>
<br>
<br>
<span class="Statement">INFORM </span><a class="Constant" href="syntax.html#inform.vim" name="inform.vim">inform.vim</a> <a class="Constant" href="syntax.html#ft-inform-syntax" name="ft-inform-syntax">ft-inform-syntax</a><br>
<br>
Inform highlighting includes symbols provided by the Inform Library, as<br>
most programs make extensive use of it. If do not wish Library symbols<br>
to be highlighted add this to your vim startup:<br>
<div class="helpExample"> :let inform_highlight_simple=1</div>
<br>
By default it is assumed that Inform programs are Z-machine targeted,<br>
and highlights Z-machine assembly language symbols appropriately. If<br>
you intend your program to be targeted to a Glulx/Glk environment you<br>
need to add this to your startup sequence:<br>
<div class="helpExample"> :let inform_highlight_glulx=1</div>
<br>
This will highlight Glulx opcodes instead, and also adds glk() to the<br>
set of highlighted system functions.<br>
<br>
The Inform compiler will flag certain obsolete keywords as errors when<br>
it encounters them. These keywords are normally highlighted as errors<br>
by Vim. To prevent such error highlighting, you must add this to your<br>
startup sequence:<br>
<div class="helpExample"> :let inform_suppress_obsolete=1</div>
<br>
By default, the language features highlighted conform to Compiler<br>
version 6.30 and Library version 6.11. If you are using an older<br>
Inform development environment, you may with to add this to your<br>
startup sequence:<br>
<div class="helpExample"> :let inform_highlight_old=1</div>
<br>
<span class="Statement">IDL </span><a class="Constant" href="syntax.html#idl.vim" name="idl.vim">idl.vim</a> <a class="Constant" href="syntax.html#idl-syntax" name="idl-syntax">idl-syntax</a><br>
<br>
IDL (Interface Definition Language) files are used to define RPC calls. In<br>
Microsoft land, this is also used for defining COM interfaces and calls.<br>
<br>
IDL's structure is simple enough to permit a full grammar based approach to<br>
rather than using a few heuristics. The result is large and somewhat<br>
repetitive but seems to work.<br>
<br>
There are some Microsoft extensions to idl files that are here. Some of them<br>
are disabled by defining idl_no_ms_extensions.<br>
<br>
The more complex of the extensions are disabled by defining idl_no_extensions.<br>
<br>
<span class="PreProc">Variable Effect</span><br>
<br>
idl_no_ms_extensions Disable some of the Microsoft specific<br>
extensions<br>
idl_no_extensions Disable complex extensions<br>
idlsyntax_showerror Show IDL errors (can be rather intrusive, but<br>
quite helpful)<br>
idlsyntax_showerror_soft Use softer colours by default for errors<br>
<br>
<br>
<span class="Statement">JAVA </span><a class="Constant" href="syntax.html#java.vim" name="java.vim">java.vim</a> <a class="Constant" href="syntax.html#ft-java-syntax" name="ft-java-syntax">ft-java-syntax</a><br>
<br>
The java.vim syntax highlighting file offers several options:<br>
<br>
In Java 1.0.2 it was never possible to have braces inside parens, so this was<br>
flagged as an error. Since Java 1.1 this is possible (with anonymous<br>
classes), and therefore is no longer marked as an error. If you prefer the old<br>
way, put the following line into your vim startup file:<br>
<div class="helpExample"> :let java_mark_braces_in_parens_as_errors=1</div>
<br>
All identifiers in java.lang.* are always visible in all classes. To<br>
highlight them use:<br>
<div class="helpExample"> :let java_highlight_java_lang_ids=1</div>
<br>
You can also highlight identifiers of most standard Java packages if you<br>
download the javaid.vim script at <span class="Constant"><a href="http://www.fleiner.com/vim/download.html">http://www.fleiner.com/vim/download.html</a></span>.<br>
If you prefer to only highlight identifiers of a certain package, say java.io<br>
use the following:<br>
<div class="helpExample"> :let java_highlight_java_io=1</div>
Check the javaid.vim file for a list of all the packages that are supported.<br>
<br>
Function names are not highlighted, as the way to find functions depends on<br>
how you write Java code. The syntax file knows two possible ways to highlight<br>
functions:<br>
<br>
If you write function declarations that are always indented by either<br>
a tab, 8 spaces or 2 spaces you may want to set<br>
<div class="helpExample"> :let java_highlight_functions="indent"</div>
However, if you follow the Java guidelines about how functions and classes are<br>
supposed to be named (with respect to upper and lowercase), use<br>
<div class="helpExample"> :let java_highlight_functions="style"</div>
If both options do not work for you, but you would still want function<br>
declarations to be highlighted create your own definitions by changing the<br>
definitions in java.vim or by creating your own java.vim which includes the<br>
original one and then adds the code to highlight functions.<br>
<br>
In Java 1.1 the functions System.out.println() and System.err.println() should<br>
only be used for debugging. Therefore it is possible to highlight debugging<br>
statements differently. To do this you must add the following definition in<br>
your startup file:<br>
<div class="helpExample"> :let java_highlight_debug=1</div>
The result will be that those statements are highlighted as 'Special'<br>
characters. If you prefer to have them highlighted differently you must define<br>
new highlightings for the following groups.:<br>
Debug, DebugSpecial, DebugString, DebugBoolean, DebugType<br>
which are used for the statement itself, special characters used in debug<br>
strings, strings, boolean constants and types (this, super) respectively. I<br>
have opted to chose another background for those statements.<br>
<br>
Javadoc is a program that takes special comments out of Java program files and<br>
creates HTML pages. The standard configuration will highlight this HTML code<br>
similarly to HTML files (see <a class="Identifier" href="syntax.html#html.vim">html.vim</a>). You can even add Javascript<br>
and CSS inside this code (see below). There are four differences however:<br>
1. The title (all characters up to the first '.' which is followed by<br>
some white space or up to the first '@') is colored differently (to change<br>
the color change the group CommentTitle).<br>
2. The text is colored as 'Comment'.<br>
3. HTML comments are colored as 'Special'<br>
4. The special Javadoc tags (@see, @param, ...) are highlighted as specials<br>
and the argument (for @see, @param, @exception) as Function.<br>
To turn this feature off add the following line to your startup file:<br>
<div class="helpExample"> :let java_ignore_javadoc=1</div>
<br>
If you use the special Javadoc comment highlighting described above you<br>
can also turn on special highlighting for Javascript, visual basic<br>
scripts and embedded CSS (stylesheets). This makes only sense if you<br>
actually have Javadoc comments that include either Javascript or embedded<br>
CSS. The options to use are<br>
<div class="helpExample"> :let java_javascript=1<br>
:let java_css=1<br>
:let java_vb=1</div>
<br>
In order to highlight nested parens with different colors define colors<br>
for javaParen, javaParen1 and javaParen2, for example with<br>
<div class="helpExample"> :hi link javaParen Comment</div>
or<br>
<div class="helpExample"> :hi javaParen ctermfg=blue guifg=#0000ff</div>
<br>
If you notice highlighting errors while scrolling backwards, which are fixed<br>
when redrawing with <span class="Special">CTRL-L</span>, try setting the "java_minlines" internal variable<br>
to a larger number:<br>
<div class="helpExample"> :let java_minlines = 50</div>
This will make the syntax synchronization start 50 lines before the first<br>
displayed line. The default value is 10. The disadvantage of using a larger<br>
number is that redrawing can become slow.<br>
<br>
<br>
<span class="Statement">LACE </span><a class="Constant" href="syntax.html#lace.vim" name="lace.vim">lace.vim</a> <a class="Constant" href="syntax.html#ft-lace-syntax" name="ft-lace-syntax">ft-lace-syntax</a><br>
<br>
Lace (Language for Assembly of Classes in Eiffel) is case insensitive, but the<br>
style guide lines are not. If you prefer case insensitive highlighting, just<br>
define the vim variable 'lace_case_insensitive' in your startup file:<br>
<div class="helpExample"> :let lace_case_insensitive=1</div>
<br>
<br>
<span class="Statement">LEX </span><a class="Constant" href="syntax.html#lex.vim" name="lex.vim">lex.vim</a> <a class="Constant" href="syntax.html#ft-lex-syntax" name="ft-lex-syntax">ft-lex-syntax</a><br>
<br>
Lex uses brute-force synchronizing as the "^%%$" section delimiter<br>
gives no clue as to what section follows. Consequently, the value for<br>
<div class="helpExample"> :syn sync minlines=300</div>
may be changed by the user if s/he is experiencing synchronization<br>
difficulties (such as may happen with large lex files).<br>
<br>
<br>
<span class="Statement">LIFELINES </span><a class="Constant" href="syntax.html#lifelines.vim" name="lifelines.vim">lifelines.vim</a> <a class="Constant" href="syntax.html#ft-lifelines-syntax" name="ft-lifelines-syntax">ft-lifelines-syntax</a><br>
<br>
To highlight deprecated functions as errors, add in your .vimrc:<br>
<br>
<div class="helpExample"> :let g:lifelines_deprecated = 1</div>
<br>
<br>
<span class="Statement">LISP </span><a class="Constant" href="syntax.html#lisp.vim" name="lisp.vim">lisp.vim</a> <a class="Constant" href="syntax.html#ft-lisp-syntax" name="ft-lisp-syntax">ft-lisp-syntax</a><br>
<br>
The lisp syntax highlighting provides two options:<br>
<br>
<div class="helpExample"> g:lisp_instring : if it exists, then "(...)" strings are highlighted<br>
as if the contents of the string were lisp.<br>
Useful for AutoLisp.<br>
g:lisp_rainbow : if it exists and is nonzero, then differing levels<br>
of parenthesization will receive different<br>
highlighting.</div>
<br>
The g:lisp_rainbow option provides 10 levels of individual colorization for<br>
the parentheses and backquoted parentheses. Because of the quantity of<br>
colorization levels, unlike non-rainbow highlighting, the rainbow mode<br>
specifies its highlighting using ctermfg and guifg, thereby bypassing the<br>
usual colorscheme control using standard highlighting groups. The actual<br>
highlighting used depends on the dark/bright setting (see <a class="Identifier" href="options.html#'bg'">'bg'</a>).<br>
<br>
<br>
<span class="Statement">LITE </span><a class="Constant" href="syntax.html#lite.vim" name="lite.vim">lite.vim</a> <a class="Constant" href="syntax.html#ft-lite-syntax" name="ft-lite-syntax">ft-lite-syntax</a><br>
<br>
There are two options for the lite syntax highlighting.<br>
<br>
If you like SQL syntax highlighting inside Strings, use this:<br>
<br>
<div class="helpExample"> :let lite_sql_query = 1</div>
<br>
For syncing, minlines defaults to 100. If you prefer another value, you can<br>
set "lite_minlines" to the value you desire. Example:<br>
<br>
<div class="helpExample"> :let lite_minlines = 200</div>
<br>
<br>
<span class="Statement">LPC </span><a class="Constant" href="syntax.html#lpc.vim" name="lpc.vim">lpc.vim</a> <a class="Constant" href="syntax.html#ft-lpc-syntax" name="ft-lpc-syntax">ft-lpc-syntax</a><br>
<br>
LPC stands for a simple, memory-efficient language: Lars Pensj| C. The<br>
file name of LPC is usually *.c. Recognizing these files as LPC would bother<br>
users writing only C programs. If you want to use LPC syntax in Vim, you<br>
should set a variable in your .vimrc file:<br>
<br>
<div class="helpExample"> :let lpc_syntax_for_c = 1</div>
<br>
If it doesn't work properly for some particular C or LPC files, use a<br>
modeline. For a LPC file:<br>
<br>
// vim:set ft=lpc:<br>
<br>
For a C file that is recognized as LPC:<br>
<br>
// vim:set ft=c:<br>
<br>
If you don't want to set the variable, use the modeline in EVERY LPC file.<br>
<br>
There are several implementations for LPC, we intend to support most widely<br>
used ones. Here the default LPC syntax is for MudOS series, for MudOS v22<br>
and before, you should turn off the sensible modifiers, and this will also<br>
assert the new efuns after v22 to be invalid, don't set this variable when<br>
you are using the latest version of MudOS:<br>
<br>
<div class="helpExample"> :let lpc_pre_v22 = 1</div>
<br>
For LpMud 3.2 series of LPC:<br>
<br>
<div class="helpExample"> :let lpc_compat_32 = 1</div>
<br>
For LPC4 series of LPC:<br>
<br>
<div class="helpExample"> :let lpc_use_lpc4_syntax = 1</div>
<br>
For uLPC series of LPC:<br>
uLPC has been developed to Pike, so you should use Pike syntax<br>
instead, and the name of your source file should be *.pike<br>
<br>
<br>
<span class="Statement">LUA </span><a class="Constant" href="syntax.html#lua.vim" name="lua.vim">lua.vim</a> <a class="Constant" href="syntax.html#ft-lua-syntax" name="ft-lua-syntax">ft-lua-syntax</a><br>
<br>
The Lua syntax file can be used for versions 4.0, 5.0, 5.1 and 5.2 (5.2 is<br>
the default). You can select one of these versions using the global variables<br>
lua_version and lua_subversion. For example, to activate Lua<br>
5.1 syntax highlighting, set the variables like this:<br>
<br>
:let lua_version = 5<br>
:let lua_subversion = 1<br>
<br>
<br>
<span class="Statement">MAIL </span><a class="Constant" href="syntax.html#mail.vim" name="mail.vim">mail.vim</a> <a class="Constant" href="syntax.html#ft-mail.vim" name="ft-mail.vim">ft-mail.vim</a><br>
<br>
Vim highlights all the standard elements of an email (headers, signatures,<br>
quoted text and URLs / email addresses). In keeping with standard conventions,<br>
signatures begin in a line containing only "--" followed optionally by<br>
whitespaces and end with a newline.<br>
<br>
Vim treats lines beginning with ']', '}', '|', '>' or a word followed by '>'<br>
as quoted text. However Vim highlights headers and signatures in quoted text<br>
only if the text is quoted with '>' (optionally followed by one space).<br>
<br>
By default mail.vim synchronises syntax to 100 lines before the first<br>
displayed line. If you have a slow machine, and generally deal with emails<br>
with short headers, you can change this to a smaller value:<br>
<br>
<div class="helpExample"> :let mail_minlines = 30</div>
<br>
<br>
<span class="Statement">MAKE </span><a class="Constant" href="syntax.html#make.vim" name="make.vim">make.vim</a> <a class="Constant" href="syntax.html#ft-make-syntax" name="ft-make-syntax">ft-make-syntax</a><br>
<br>
In makefiles, commands are usually highlighted to make it easy for you to spot<br>
errors. However, this may be too much coloring for you. You can turn this<br>
feature off by using:<br>
<br>
<div class="helpExample"> :let make_no_commands = 1</div>
<br>
<br>
<span class="Statement">MAPLE </span><a class="Constant" href="syntax.html#maple.vim" name="maple.vim">maple.vim</a> <a class="Constant" href="syntax.html#ft-maple-syntax" name="ft-maple-syntax">ft-maple-syntax</a><br>
<br>
Maple V, by Waterloo Maple Inc, supports symbolic algebra. The language<br>
supports many packages of functions which are selectively loaded by the user.<br>
The standard set of packages' functions as supplied in Maple V release 4 may be<br>
highlighted at the user's discretion. Users may place in their .vimrc file:<br>
<br>
<div class="helpExample"> :let mvpkg_all= 1</div>
<br>
to get all package functions highlighted, or users may select any subset by<br>
choosing a variable/package from the table below and setting that variable to<br>
1, also in their .vimrc file (prior to sourcing<br>
$VIMRUNTIME/syntax/syntax.vim).<br>
<br>
Table of Maple V Package Function Selectors<br>
<div class="helpExample"> mv_DEtools mv_genfunc mv_networks mv_process<br>
mv_Galois mv_geometry mv_numapprox mv_simplex<br>
mv_GaussInt mv_grobner mv_numtheory mv_stats<br>
mv_LREtools mv_group mv_orthopoly mv_student<br>
mv_combinat mv_inttrans mv_padic mv_sumtools<br>
mv_combstruct mv_liesymm mv_plots mv_tensor<br>
mv_difforms mv_linalg mv_plottools mv_totorder<br>
mv_finance mv_logic mv_powseries</div>
<br>
<br>
<span class="Statement">MATHEMATICA </span><a class="Constant" href="syntax.html#mma.vim" name="mma.vim">mma.vim</a> <a class="Constant" href="syntax.html#ft-mma-syntax" name="ft-mma-syntax">ft-mma-syntax</a> <a class="Constant" href="syntax.html#ft-mathematica-syntax" name="ft-mathematica-syntax">ft-mathematica-syntax</a><br>
<br>
Empty *.m files will automatically be presumed to be Matlab files unless you<br>
have the following in your .vimrc:<br>
<br>
<div class="helpExample"> let filetype_m = "mma"</div>
<br>
<br>
<span class="Statement">MOO </span><a class="Constant" href="syntax.html#moo.vim" name="moo.vim">moo.vim</a> <a class="Constant" href="syntax.html#ft-moo-syntax" name="ft-moo-syntax">ft-moo-syntax</a><br>
<br>
If you use C-style comments inside expressions and find it mangles your<br>
highlighting, you may want to use extended (slow!) matches for C-style<br>
comments:<br>
<br>
<div class="helpExample"> :let moo_extended_cstyle_comments = 1</div>
<br>
To disable highlighting of pronoun substitution patterns inside strings:<br>
<br>
<div class="helpExample"> :let moo_no_pronoun_sub = 1</div>
<br>
To disable highlighting of the regular expression operator '%|', and matching<br>
'%(' and '%)' inside strings:<br>
<br>
<div class="helpExample"> :let moo_no_regexp = 1</div>
<br>
Unmatched double quotes can be recognized and highlighted as errors:<br>
<br>
<div class="helpExample"> :let moo_unmatched_quotes = 1</div>
<br>
To highlight builtin properties (.name, .location, .programmer etc.):<br>
<br>
<div class="helpExample"> :let moo_builtin_properties = 1</div>
<br>
Unknown builtin functions can be recognized and highlighted as errors. If you<br>
use this option, add your own extensions to the mooKnownBuiltinFunction group.<br>
To enable this option:<br>
<br>
<div class="helpExample"> :let moo_unknown_builtin_functions = 1</div>
<br>
An example of adding sprintf() to the list of known builtin functions:<br>
<br>
<div class="helpExample"> :syn keyword mooKnownBuiltinFunction sprintf contained</div>
<br>
<br>
<span class="Statement">MSQL </span><a class="Constant" href="syntax.html#msql.vim" name="msql.vim">msql.vim</a> <a class="Constant" href="syntax.html#ft-msql-syntax" name="ft-msql-syntax">ft-msql-syntax</a><br>
<br>
There are two options for the msql syntax highlighting.<br>
<br>
If you like SQL syntax highlighting inside Strings, use this:<br>
<br>
<div class="helpExample"> :let msql_sql_query = 1</div>
<br>
For syncing, minlines defaults to 100. If you prefer another value, you can<br>
set "msql_minlines" to the value you desire. Example:<br>
<br>
<div class="helpExample"> :let msql_minlines = 200</div>
<br>
<br>
<span class="Statement">NCF </span><a class="Constant" href="syntax.html#ncf.vim" name="ncf.vim">ncf.vim</a> <a class="Constant" href="syntax.html#ft-ncf-syntax" name="ft-ncf-syntax">ft-ncf-syntax</a><br>
<br>
There is one option for NCF syntax highlighting.<br>
<br>
If you want to have unrecognized (by ncf.vim) statements highlighted as<br>
errors, use this:<br>
<br>
<div class="helpExample"> :let ncf_highlight_unknowns = 1</div>
<br>
If you don't want to highlight these errors, leave it unset.<br>
<br>
<br>
<span class="Statement">NROFF </span><a class="Constant" href="syntax.html#nroff.vim" name="nroff.vim">nroff.vim</a> <a class="Constant" href="syntax.html#ft-nroff-syntax" name="ft-nroff-syntax">ft-nroff-syntax</a><br>
<br>
The nroff syntax file works with AT&T n/troff out of the box. You need to<br>
activate the GNU groff extra features included in the syntax file before you<br>
can use them.<br>
<br>
For example, Linux and BSD distributions use groff as their default text<br>
processing package. In order to activate the extra syntax highlighting<br>
features for groff, add the following option to your start-up files:<br>
<br>
<div class="helpExample"> :let b:nroff_is_groff = 1</div>
<br>
Groff is different from the old AT&T n/troff that you may still find in<br>
Solaris. Groff macro and request names can be longer than 2 characters and<br>
there are extensions to the language primitives. For example, in AT&T troff<br>
you access the year as a 2-digit number with the request \(yr. In groff you<br>
can use the same request, recognized for compatibility, or you can use groff's<br>
native syntax, \[yr]. Furthermore, you can use a 4-digit year directly:<br>
\[year]. Macro requests can be longer than 2 characters, for example, GNU mm<br>
accepts the requests ".VERBON" and ".VERBOFF" for creating verbatim<br>
environments.<br>
<br>
In order to obtain the best formatted output g/troff can give you, you should<br>
follow a few simple rules about spacing and punctuation.<br>
<br>
1. Do not leave empty spaces at the end of lines.<br>
<br>
2. Leave one space and one space only after an end-of-sentence period,<br>
exclamation mark, etc.<br>
<br>
3. For reasons stated below, it is best to follow all period marks with a<br>
carriage return.<br>
<br>
The reason behind these unusual tips is that g/n/troff have a line breaking<br>
algorithm that can be easily upset if you don't follow the rules given above.<br>
<br>
Unlike TeX, troff fills text line-by-line, not paragraph-by-paragraph and,<br>
furthermore, it does not have a concept of glue or stretch, all horizontal and<br>
vertical space input will be output as is.<br>
<br>
Therefore, you should be careful about not using more space between sentences<br>
than you intend to have in your final document. For this reason, the common<br>
practice is to insert a carriage return immediately after all punctuation<br>
marks. If you want to have "even" text in your final processed output, you<br>
need to maintain regular spacing in the input text. To mark both trailing<br>
spaces and two or more spaces after a punctuation as an error, use:<br>
<br>
<div class="helpExample"> :let nroff_space_errors = 1</div>
<br>
Another technique to detect extra spacing and other errors that will interfere<br>
with the correct typesetting of your file, is to define an eye-catching<br>
highlighting definition for the syntax groups "nroffDefinition" and<br>
"nroffDefSpecial" in your configuration files. For example:<br>
<br>
<div class="helpExample"> hi def nroffDefinition term=italic cterm=italic gui=reverse<br>
hi def nroffDefSpecial term=italic,bold cterm=italic,bold<br>
\ gui=reverse,bold</div>
<br>
If you want to navigate preprocessor entries in your source file as easily as<br>
with section markers, you can activate the following option in your .vimrc<br>
file:<br>
<br>
<div class="helpExample"> let b:preprocs_as_sections = 1</div>
<br>
As well, the syntax file adds an extra paragraph marker for the extended<br>
paragraph macro (.XP) in the ms package.<br>
<br>
Finally, there is a <a class="Identifier" href="syntax.html#groff.vim">groff.vim</a> syntax file that can be used for enabling<br>
groff syntax highlighting either on a file basis or globally by default.<br>
<br>
<br>
<span class="Statement">OCAML </span><a class="Constant" href="syntax.html#ocaml.vim" name="ocaml.vim">ocaml.vim</a> <a class="Constant" href="syntax.html#ft-ocaml-syntax" name="ft-ocaml-syntax">ft-ocaml-syntax</a><br>
<br>
The OCaml syntax file handles files having the following prefixes: .ml,<br>
.mli, .mll and .mly. By setting the following variable<br>
<br>
<div class="helpExample"> :let ocaml_revised = 1</div>
<br>
you can switch from standard OCaml-syntax to revised syntax as supported<br>
by the camlp4 preprocessor. Setting the variable<br>
<br>
<div class="helpExample"> :let ocaml_noend_error = 1</div>
<br>
prevents highlighting of "end" as error, which is useful when sources<br>
contain very long structures that Vim does not synchronize anymore.<br>
<br>
<br>
<span class="Statement">PAPP </span><a class="Constant" href="syntax.html#papp.vim" name="papp.vim">papp.vim</a> <a class="Constant" href="syntax.html#ft-papp-syntax" name="ft-papp-syntax">ft-papp-syntax</a><br>
<br>
The PApp syntax file handles .papp files and, to a lesser extend, .pxml<br>
and .pxsl files which are all a mixture of perl/xml/html/other using xml<br>
as the top-level file format. By default everything inside phtml or pxml<br>
sections is treated as a string with embedded preprocessor commands. If<br>
you set the variable:<br>
<br>
<div class="helpExample"> :let papp_include_html=1</div>
<br>
in your startup file it will try to syntax-hilight html code inside phtml<br>
sections, but this is relatively slow and much too colourful to be able to<br>
edit sensibly. ;)<br>
<br>
The newest version of the papp.vim syntax file can usually be found at<br>
<span class="Constant"><a href="http://papp.plan9.de">http://papp.plan9.de</a></span>.<br>
<br>
<br>
<span class="Statement">PASCAL </span><a class="Constant" href="syntax.html#pascal.vim" name="pascal.vim">pascal.vim</a> <a class="Constant" href="syntax.html#ft-pascal-syntax" name="ft-pascal-syntax">ft-pascal-syntax</a><br>
<br>
Files matching "*.p" could be Progress or Pascal. If the automatic detection<br>
doesn't work for you, or you don't edit Progress at all, use this in your<br>
startup vimrc:<br>
<br>
<div class="helpExample"> :let filetype_p = "pascal"</div>
<br>
The Pascal syntax file has been extended to take into account some extensions<br>
provided by Turbo Pascal, Free Pascal Compiler and GNU Pascal Compiler.<br>
Delphi keywords are also supported. By default, Turbo Pascal 7.0 features are<br>
enabled. If you prefer to stick with the standard Pascal keywords, add the<br>
following line to your startup file:<br>
<br>
<div class="helpExample"> :let pascal_traditional=1</div>
<br>
To switch on Delphi specific constructions (such as one-line comments,<br>
keywords, etc):<br>
<br>
<div class="helpExample"> :let pascal_delphi=1</div>
<br>
<br>
The option pascal_symbol_operator controls whether symbol operators such as +,<br>
*, .., etc. are displayed using the Operator color or not. To colorize symbol<br>
operators, add the following line to your startup file:<br>
<br>
<div class="helpExample"> :let pascal_symbol_operator=1</div>
<br>
Some functions are highlighted by default. To switch it off:<br>
<br>
<div class="helpExample"> :let pascal_no_functions=1</div>
<br>
Furthermore, there are specific variables for some compilers. Besides<br>
pascal_delphi, there are pascal_gpc and pascal_fpc. Default extensions try to<br>
match Turbo Pascal.<br>
<br>
<div class="helpExample"> :let pascal_gpc=1</div>
<br>
or<br>
<br>
<div class="helpExample"> :let pascal_fpc=1</div>
<br>
To ensure that strings are defined on a single line, you can define the<br>
pascal_one_line_string variable.<br>
<br>
<div class="helpExample"> :let pascal_one_line_string=1</div>
<br>
If you dislike <span class="Special"><Tab></span> chars, you can set the pascal_no_tabs variable. Tabs<br>
will be highlighted as Error.<br>
<br>
<div class="helpExample"> :let pascal_no_tabs=1</div>
<br>
<br>
<br>
<span class="Statement">PERL </span><a class="Constant" href="syntax.html#perl.vim" name="perl.vim">perl.vim</a> <a class="Constant" href="syntax.html#ft-perl-syntax" name="ft-perl-syntax">ft-perl-syntax</a><br>
<br>
There are a number of possible options to the perl syntax highlighting.<br>
<br>
Inline POD highlighting is now turned on by default. If you don't wish<br>
to have the added complexity of highlighting POD embedded within Perl<br>
files, you may set the 'perl_include_pod' option to 0:<br>
<br>
<div class="helpExample"> :let perl_include_pod = 0</div>
<br>
To reduce the complexity of parsing (and increase performance) you can switch<br>
off two elements in the parsing of variable names and contents.<br>
<br>
To handle package references in variable and function names not differently<br>
from the rest of the name (like 'PkgName::' in '$PkgName::VarName'):<br>
<br>
<div class="helpExample"> :let perl_no_scope_in_variables = 1</div>
<br>
(In Vim 6.x it was the other way around: "perl_want_scope_in_variables"<br>
enabled it.)<br>
<br>
If you do not want complex things like '@{$<span class="Special">{"foo"}</span>}' to be parsed:<br>
<br>
<div class="helpExample"> :let perl_no_extended_vars = 1</div>
<br>
(In Vim 6.x it was the other way around: "perl_extended_vars" enabled it.)<br>
<br>
The coloring strings can be changed. By default strings and qq friends will be<br>
highlighted like the first line. If you set the variable<br>
perl_string_as_statement, it will be highlighted as in the second line.<br>
<br>
"hello world!"; qq|hello world|;<br>
^^^^^^^^^^^^^^NN^^^^^^^^^^^^^^^<span class="Special">N</span> (unlet perl_string_as_statement)<br>
S^^^^^^^^^^^^SNNSSS^^^^^^^^^^^SN (let perl_string_as_statement)<br>
<br>
(^ = perlString, S = perlStatement, <span class="Special">N</span> = None at all)<br>
<br>
The syncing has 3 options. The first two switch off some triggering of<br>
synchronization and should only be needed in case it fails to work properly.<br>
If while scrolling all of a sudden the whole screen changes color completely<br>
then you should try and switch off one of those. Let me know if you can figure<br>
out the line that causes the mistake.<br>
<br>
One triggers on "^\s*sub\s*" and the other on "^[$@%]" more or less.<br>
<br>
<div class="helpExample"> :let perl_no_sync_on_sub<br>
:let perl_no_sync_on_global_var</div>
<br>
Below you can set the maximum distance VIM should look for starting points for<br>
its attempts in syntax highlighting.<br>
<br>
<div class="helpExample"> :let perl_sync_dist = 100</div>
<br>
If you want to use folding with perl, set perl_fold:<br>
<br>
<div class="helpExample"> :let perl_fold = 1</div>
<br>
If you want to fold blocks in if statements, etc. as well set the following:<br>
<br>
<div class="helpExample"> :let perl_fold_blocks = 1</div>
<br>
Subroutines are folded by default if 'perl_fold' is set. If you do not want<br>
this, you can set 'perl_nofold_subs':<br>
<br>
<div class="helpExample"> :let perl_nofold_subs = 1</div>
<br>
Anonymous subroutines are not folded by default; you may enable their folding<br>
via 'perl_fold_anonymous_subs':<br>
<br>
<div class="helpExample"> :let perl_fold_anonymous_subs = 1</div>
<br>
Packages are also folded by default if 'perl_fold' is set. To disable this<br>
behavior, set 'perl_nofold_packages':<br>
<br>
<div class="helpExample"> :let perl_nofold_packages = 1</div>
<br>
PHP3 and PHP4 <a class="Constant" href="syntax.html#php.vim" name="php.vim">php.vim</a> <a class="Constant" href="syntax.html#php3.vim" name="php3.vim">php3.vim</a> <a class="Constant" href="syntax.html#ft-php-syntax" name="ft-php-syntax">ft-php-syntax</a> <a class="Constant" href="syntax.html#ft-php3-syntax" name="ft-php3-syntax">ft-php3-syntax</a><br>
<br>
[<span class="Todo">note</span>: previously this was called "php3", but since it now also supports php4<br>
it has been renamed to "php"]<br>
<br>
There are the following options for the php syntax highlighting.<br>
<br>
If you like SQL syntax highlighting inside Strings:<br>
<br>
<div class="helpExample"> let php_sql_query = 1</div>
<br>
For highlighting the Baselib methods:<br>
<br>
<div class="helpExample"> let php_baselib = 1</div>
<br>
Enable HTML syntax highlighting inside strings:<br>
<br>
<div class="helpExample"> let php_htmlInStrings = 1</div>
<br>
Using the old colorstyle:<br>
<br>
<div class="helpExample"> let php_oldStyle = 1</div>
<br>
Enable highlighting ASP-style short tags:<br>
<br>
<div class="helpExample"> let php_asp_tags = 1</div>
<br>
Disable short tags:<br>
<br>
<div class="helpExample"> let php_noShortTags = 1</div>
<br>
For highlighting parent error ] or ):<br>
<br>
<div class="helpExample"> let php_parent_error_close = 1</div>
<br>
For skipping a php end tag, if there exists an open ( or [ without a closing<br>
one:<br>
<br>
<div class="helpExample"> let php_parent_error_open = 1</div>
<br>
Enable folding for classes and functions:<br>
<br>
<div class="helpExample"> let php_folding = 1</div>
<br>
Selecting syncing method:<br>
<br>
<div class="helpExample"> let php_sync_method = x</div>
<br>
x = -1 to sync by search (default),<br>
x > 0 to sync at least x lines backwards,<br>
x = 0 to sync from start.<br>
<br>
<br>
<span class="Statement">PLAINTEX </span><a class="Constant" href="syntax.html#plaintex.vim" name="plaintex.vim">plaintex.vim</a> <a class="Constant" href="syntax.html#ft-plaintex-syntax" name="ft-plaintex-syntax">ft-plaintex-syntax</a><br>
<br>
TeX is a typesetting language, and plaintex is the file type for the "plain"<br>
variant of TeX. If you never want your *.tex files recognized as plain TeX,<br>
see <a class="Identifier" href="filetype.html#ft-tex-plugin">ft-tex-plugin</a>.<br>
<br>
This syntax file has the option<br>
<br>
<div class="helpExample"> let g:plaintex_delimiters = 1</div>
<br>
if you want to highlight brackets "[]" and braces "{}".<br>
<br>
<br>
<span class="Statement">PPWIZARD </span><a class="Constant" href="syntax.html#ppwiz.vim" name="ppwiz.vim">ppwiz.vim</a> <a class="Constant" href="syntax.html#ft-ppwiz-syntax" name="ft-ppwiz-syntax">ft-ppwiz-syntax</a><br>
<br>
PPWizard is a preprocessor for HTML and OS/2 INF files<br>
<br>
This syntax file has the options:<br>
<br>
- ppwiz_highlight_defs : determines highlighting mode for PPWizard's<br>
definitions. Possible values are<br>
<br>
ppwiz_highlight_defs = 1 : PPWizard #define statements retain the<br>
colors of their contents (e.g. PPWizard macros and variables)<br>
<br>
ppwiz_highlight_defs = 2 : preprocessor #define and #evaluate<br>
statements are shown in a single color with the exception of line<br>
continuation symbols<br>
<br>
The default setting for ppwiz_highlight_defs is 1.<br>
<br>
- ppwiz_with_html : If the value is 1 (the default), highlight literal<br>
HTML code; if 0, treat HTML code like ordinary text.<br>
<br>
<br>
<span class="Statement">PHTML </span><a class="Constant" href="syntax.html#phtml.vim" name="phtml.vim">phtml.vim</a> <a class="Constant" href="syntax.html#ft-phtml-syntax" name="ft-phtml-syntax">ft-phtml-syntax</a><br>
<br>
There are two options for the phtml syntax highlighting.<br>
<br>
If you like SQL syntax highlighting inside Strings, use this:<br>
<br>
<div class="helpExample"> :let phtml_sql_query = 1</div>
<br>
For syncing, minlines defaults to 100. If you prefer another value, you can<br>
set "phtml_minlines" to the value you desire. Example:<br>
<br>
<div class="helpExample"> :let phtml_minlines = 200</div>
<br>
<br>
<span class="Statement">POSTSCRIPT </span><a class="Constant" href="syntax.html#postscr.vim" name="postscr.vim">postscr.vim</a> <a class="Constant" href="syntax.html#ft-postscr-syntax" name="ft-postscr-syntax">ft-postscr-syntax</a><br>
<br>
There are several options when it comes to highlighting PostScript.<br>
<br>
First which version of the PostScript language to highlight. There are<br>
currently three defined language versions, or levels. Level 1 is the original<br>
and base version, and includes all extensions prior to the release of level 2.<br>
Level 2 is the most common version around, and includes its own set of<br>
extensions prior to the release of level 3. Level 3 is currently the highest<br>
level supported. You select which level of the PostScript language you want<br>
highlighted by defining the postscr_level variable as follows:<br>
<br>
<div class="helpExample"> :let postscr_level=2</div>
<br>
If this variable is not defined it defaults to 2 (level 2) since this is<br>
the most prevalent version currently.<br>
<br>
<span class="Todo">Note</span>, not all PS interpreters will support all language features for a<br>
particular language level. In particular the %!PS-Adobe-3.0 at the start of<br>
PS files does NOT mean the PostScript present is level 3 PostScript!<br>
<br>
If you are working with Display PostScript, you can include highlighting of<br>
Display PS language features by defining the postscr_display variable as<br>
follows:<br>
<br>
<div class="helpExample"> :let postscr_display=1</div>
<br>
If you are working with Ghostscript, you can include highlighting of<br>
Ghostscript specific language features by defining the variable<br>
postscr_ghostscript as follows:<br>
<br>
<div class="helpExample"> :let postscr_ghostscript=1</div>
<br>
PostScript is a large language, with many predefined elements. While it<br>
useful to have all these elements highlighted, on slower machines this can<br>
cause Vim to slow down. In an attempt to be machine friendly font names and<br>
character encodings are not highlighted by default. Unless you are working<br>
explicitly with either of these this should be ok. If you want them to be<br>
highlighted you should set one or both of the following variables:<br>
<br>
<div class="helpExample"> :let postscr_fonts=1<br>
:let postscr_encodings=1</div>
<br>
There is a stylistic option to the highlighting of and, or, and not. In<br>
PostScript the function of these operators depends on the types of their<br>
operands - if the operands are booleans then they are the logical operators,<br>
if they are integers then they are binary operators. As binary and logical<br>
operators can be highlighted differently they have to be highlighted one way<br>
or the other. By default they are treated as logical operators. They can be<br>
highlighted as binary operators by defining the variable<br>
postscr_andornot_binary as follows:<br>
<br>
<div class="helpExample"> :let postscr_andornot_binary=1</div>
<br>
<br>
<a class="Constant" href="syntax.html#ptcap.vim" name="ptcap.vim">ptcap.vim</a> <a class="Constant" href="syntax.html#ft-printcap-syntax" name="ft-printcap-syntax">ft-printcap-syntax</a><br>
PRINTCAP + TERMCAP <a class="Constant" href="syntax.html#ft-ptcap-syntax" name="ft-ptcap-syntax">ft-ptcap-syntax</a> <a class="Constant" href="syntax.html#ft-termcap-syntax" name="ft-termcap-syntax">ft-termcap-syntax</a><br>
<br>
This syntax file applies to the printcap and termcap databases.<br>
<br>
In order for Vim to recognize printcap/termcap files that do not match<br>
the patterns *printcap*, or *termcap*, you must put additional patterns<br>
appropriate to your system in your <a class="Identifier" href="syntax.html#myfiletypefile">myfiletypefile</a> file. For these<br>
patterns, you must set the variable "b:ptcap_type" to either "print" or<br>
"term", and then the <a class="Type" href="options.html#'filetype'">'filetype'</a> option to ptcap.<br>
<br>
For example, to make Vim identify all files in /etc/termcaps/ as termcap<br>
files, add the following:<br>
<br>
<div class="helpExample"> :au BufNewFile,BufRead /etc/termcaps/* let b:ptcap_type = "term" |<br>
\ set filetype=ptcap</div>
<br>
If you notice highlighting errors while scrolling backwards, which<br>
are fixed when redrawing with <span class="Special">CTRL-L</span>, try setting the "ptcap_minlines"<br>
internal variable to a larger number:<br>
<br>
<div class="helpExample"> :let ptcap_minlines = 50</div>
<br>
(The default is 20 lines.)<br>
<br>
<br>
<span class="Statement">PROGRESS </span><a class="Constant" href="syntax.html#progress.vim" name="progress.vim">progress.vim</a> <a class="Constant" href="syntax.html#ft-progress-syntax" name="ft-progress-syntax">ft-progress-syntax</a><br>
<br>
Files matching "*.w" could be Progress or cweb. If the automatic detection<br>
doesn't work for you, or you don't edit cweb at all, use this in your<br>
startup vimrc:<br>
<div class="helpExample"> :let filetype_w = "progress"</div>
The same happens for "*.i", which could be assembly, and "*.p", which could be<br>
Pascal. Use this if you don't use assembly and Pascal:<br>
<div class="helpExample"> :let filetype_i = "progress"<br>
:let filetype_p = "progress"</div>
<br>
<br>
<span class="Statement">PYTHON </span><a class="Constant" href="syntax.html#python.vim" name="python.vim">python.vim</a> <a class="Constant" href="syntax.html#ft-python-syntax" name="ft-python-syntax">ft-python-syntax</a><br>
<br>
There are six options to control Python syntax highlighting.<br>
<br>
For highlighted numbers:<br>
<div class="helpExample"> :let python_no_number_highlight = 1</div>
<br>
For highlighted builtin functions:<br>
<div class="helpExample"> :let python_no_builtin_highlight = 1</div>
<br>
For highlighted standard exceptions:<br>
<div class="helpExample"> :let python_no_exception_highlight = 1</div>
<br>
For highlighted doctests and code inside:<br>
<div class="helpExample"> :let python_no_doctest_highlight = 1</div>
or<br>
<div class="helpExample"> :let python_no_doctest_code_highlight = 1</div>
(first option implies second one).<br>
<br>
For highlighted trailing whitespace and mix of spaces and tabs:<br>
<div class="helpExample"> :let python_space_error_highlight = 1</div>
<br>
If you want all possible Python highlighting (the same as setting the<br>
preceding last option and unsetting all other ones):<br>
<div class="helpExample"> :let python_highlight_all = 1</div>
<br>
<span class="Todo">Note</span>: only existence of these options matter, not their value. You can replace<br>
1 above with anything.<br>
<br>
<br>
<span class="Statement">QUAKE </span><a class="Constant" href="syntax.html#quake.vim" name="quake.vim">quake.vim</a> <a class="Constant" href="syntax.html#ft-quake-syntax" name="ft-quake-syntax">ft-quake-syntax</a><br>
<br>
The Quake syntax definition should work for most any FPS (First Person<br>
Shooter) based on one of the Quake engines. However, the command names vary<br>
a bit between the three games (Quake, Quake 2, and Quake 3 Arena) so the<br>
syntax definition checks for the existence of three global variables to allow<br>
users to specify what commands are legal in their files. The three variables<br>
can be set for the following effects:<br>
<br>
set to highlight commands only available in Quake:<br>
<div class="helpExample"> :let quake_is_quake1 = 1</div>
<br>
set to highlight commands only available in Quake 2:<br>
<div class="helpExample"> :let quake_is_quake2 = 1</div>
<br>
set to highlight commands only available in Quake 3 Arena:<br>
<div class="helpExample"> :let quake_is_quake3 = 1</div>
<br>
Any combination of these three variables is legal, but might highlight more<br>
commands than are actually available to you by the game.<br>
<br>
<br>
<span class="Statement">READLINE </span><a class="Constant" href="syntax.html#readline.vim" name="readline.vim">readline.vim</a> <a class="Constant" href="syntax.html#ft-readline-syntax" name="ft-readline-syntax">ft-readline-syntax</a><br>
<br>
The readline library is primarily used by the BASH shell, which adds quite a<br>
few commands and options to the ones already available. To highlight these<br>
items as well you can add the following to your <a class="Identifier" href="starting.html#vimrc">vimrc</a> or just type it in the<br>
command line before loading a file with the readline syntax:<br>
<div class="helpExample"> let readline_has_bash = 1</div>
<br>
This will add highlighting for the commands that BASH (version 2.05a and<br>
later, and part earlier) adds.<br>
<br>
<br>
<span class="Statement">RESTRUCTURED TEXT </span><a class="Constant" href="syntax.html#rst.vim" name="rst.vim">rst.vim</a> <a class="Constant" href="syntax.html#ft-rst-syntax" name="ft-rst-syntax">ft-rst-syntax</a><br>
<br>
You may set what syntax definitions should be used for code blocks via<br>
<div class="helpExample"> let rst_syntax_code_list = ['vim', 'lisp', ...]</div>
<br>
<br>
<span class="Statement">REXX </span><a class="Constant" href="syntax.html#rexx.vim" name="rexx.vim">rexx.vim</a> <a class="Constant" href="syntax.html#ft-rexx-syntax" name="ft-rexx-syntax">ft-rexx-syntax</a><br>
<br>
If you notice highlighting errors while scrolling backwards, which are fixed<br>
when redrawing with <span class="Special">CTRL-L</span>, try setting the "rexx_minlines" internal variable<br>
to a larger number:<br>
<div class="helpExample"> :let rexx_minlines = 50</div>
This will make the syntax synchronization start 50 lines before the first<br>
displayed line. The default value is 10. The disadvantage of using a larger<br>
number is that redrawing can become slow.<br>
<br>
Vim tries to guess what type a ".r" file is. If it can't be detected (from<br>
comment lines), the default is "r". To make the default rexx add this line to<br>
your .vimrc: <a class="Constant" href="syntax.html#g:filetype_r" name="g:filetype_r">g:filetype_r</a><br>
<br>
<div class="helpExample"> :let g:filetype_r = "r"</div>
<br>
<br>
<span class="Statement">RUBY </span><a class="Constant" href="syntax.html#ruby.vim" name="ruby.vim">ruby.vim</a> <a class="Constant" href="syntax.html#ft-ruby-syntax" name="ft-ruby-syntax">ft-ruby-syntax</a><br>
<br>
Ruby: Operator highlighting <a class="Identifier" href="syntax.html#ruby_operators">ruby_operators</a><br>
Ruby: Whitespace errors <a class="Identifier" href="syntax.html#ruby_space_errors">ruby_space_errors</a><br>
Ruby: Folding <a class="Identifier" href="syntax.html#ruby_fold">ruby_fold</a> <a class="Identifier" href="syntax.html#ruby_foldable_groups">ruby_foldable_groups</a><br>
Ruby: Reducing expensive operations <a class="Identifier" href="syntax.html#ruby_no_expensive">ruby_no_expensive</a> <a class="Identifier" href="syntax.html#ruby_minlines">ruby_minlines</a><br>
Ruby: Spellchecking strings <a class="Identifier" href="syntax.html#ruby_spellcheck_strings">ruby_spellcheck_strings</a><br>
<br>
<a class="Constant" href="syntax.html#ruby_operators" name="ruby_operators">ruby_operators</a><br>
<span class="PreProc">Ruby: Operator highlighting</span><br>
<br>
Operators can be highlighted by defining "ruby_operators":<br>
<br>
<div class="helpExample"> :let ruby_operators = 1</div>
<br>
<a class="Constant" href="syntax.html#ruby_space_errors" name="ruby_space_errors">ruby_space_errors</a><br>
<span class="PreProc">Ruby: Whitespace errors</span><br>
<br>
Whitespace errors can be highlighted by defining "ruby_space_errors":<br>
<br>
<div class="helpExample"> :let ruby_space_errors = 1</div>
<br>
This will highlight trailing whitespace and tabs preceded by a space character<br>
as errors. This can be refined by defining "ruby_no_trail_space_error" and<br>
"ruby_no_tab_space_error" which will ignore trailing whitespace and tabs after<br>
spaces respectively.<br>
<br>
<a class="Constant" href="syntax.html#ruby_fold" name="ruby_fold">ruby_fold</a> <a class="Constant" href="syntax.html#ruby_foldable_groups" name="ruby_foldable_groups">ruby_foldable_groups</a><br>
<span class="PreProc">Ruby: Folding</span><br>
<br>
Folding can be enabled by defining "ruby_fold":<br>
<br>
<div class="helpExample"> :let ruby_fold = 1</div>
<br>
This will set the value of <a class="Type" href="options.html#'foldmethod'">'foldmethod'</a> to "syntax" locally to the current<br>
buffer or window, which will enable syntax-based folding when editing Ruby<br>
filetypes.<br>
<br>
Default folding is rather detailed, i.e., small syntax units like "if", "do",<br>
"%w[]" may create corresponding fold levels.<br>
<br>
You can set "ruby_foldable_groups" to restrict which groups are foldable:<br>
<br>
<div class="helpExample"> :let ruby_foldable_groups = 'if case %'</div>
<br>
The value is a space-separated list of keywords:<br>
<br>
<span class="PreProc">keyword meaning</span><br>
<span class="PreProc">-------- -------------------------------------</span><br>
ALL Most block syntax (default)<br>
NONE Nothing<br>
if "if" or "unless" block<br>
def "def" block<br>
class "class" block<br>
module "module" block<br>
do "do" block<br>
begin "begin" block<br>
case "case" block<br>
for "for", "while", "until" loops<br>
{ Curly bracket block or hash literal<br>
[ Array literal<br>
% Literal with "%" notation, e.g.: %w(STRING), %!STRING!<br>
/ Regexp<br>
string String and shell command output (surrounded by ', ", `)<br>
: Symbol<br>
# Multiline comment<br>
<< Here documents<br>
__END__ Source code after "__END__" directive<br>
<br>
<a class="Constant" href="syntax.html#ruby_no_expensive" name="ruby_no_expensive">ruby_no_expensive</a><br>
<span class="PreProc">Ruby: Reducing expensive operations</span><br>
<br>
By default, the "end" keyword is colorized according to the opening statement<br>
of the block it closes. While useful, this feature can be expensive; if you<br>
experience slow redrawing (or you are on a terminal with poor color support)<br>
you may want to turn it off by defining the "ruby_no_expensive" variable:<br>
<br>
<div class="helpExample"> :let ruby_no_expensive = 1</div>
<br>
In this case the same color will be used for all control keywords.<br>
<br>
<a class="Constant" href="syntax.html#ruby_minlines" name="ruby_minlines">ruby_minlines</a><br>
<br>
If you do want this feature enabled, but notice highlighting errors while<br>
scrolling backwards, which are fixed when redrawing with <span class="Special">CTRL-L</span>, try setting<br>
the "ruby_minlines" variable to a value larger than 50:<br>
<br>
<div class="helpExample"> :let ruby_minlines = 100</div>
<br>
Ideally, this value should be a number of lines large enough to embrace your<br>
largest class or module.<br>
<br>
<a class="Constant" href="syntax.html#ruby_spellcheck_strings" name="ruby_spellcheck_strings">ruby_spellcheck_strings</a><br>
<span class="PreProc">Ruby: Spellchecking strings</span><br>
<br>
Ruby syntax will perform spellchecking of strings if you define<br>
"ruby_spellcheck_strings":<br>
<br>
<div class="helpExample"> :let ruby_spellcheck_strings = 1</div>
<br>
<br>
<span class="Statement">SCHEME </span><a class="Constant" href="syntax.html#scheme.vim" name="scheme.vim">scheme.vim</a> <a class="Constant" href="syntax.html#ft-scheme-syntax" name="ft-scheme-syntax">ft-scheme-syntax</a><br>
<br>
By default only R5RS keywords are highlighted and properly indented.<br>
<br>
MzScheme-specific stuff will be used if b:is_mzscheme or g:is_mzscheme<br>
variables are defined.<br>
<br>
Also scheme.vim supports keywords of the Chicken Scheme->C compiler. Define<br>
b:is_chicken or g:is_chicken, if you need them.<br>
<br>
<br>
<span class="Statement">SDL </span><a class="Constant" href="syntax.html#sdl.vim" name="sdl.vim">sdl.vim</a> <a class="Constant" href="syntax.html#ft-sdl-syntax" name="ft-sdl-syntax">ft-sdl-syntax</a><br>
<br>
The SDL highlighting probably misses a few keywords, but SDL has so many<br>
of them it's almost impossibly to cope.<br>
<br>
The new standard, SDL-2000, specifies that all identifiers are<br>
case-sensitive (which was not so before), and that all keywords can be<br>
used either completely lowercase or completely uppercase. To have the<br>
highlighting reflect this, you can set the following variable:<br>
<div class="helpExample"> :let sdl_2000=1</div>
<br>
This also sets many new keywords. If you want to disable the old<br>
keywords, which is probably a good idea, use:<br>
<div class="helpExample"> :let SDL_no_96=1</div>
<br>
<br>
The indentation is probably also incomplete, but right now I am very<br>
satisfied with it for my own projects.<br>
<br>
<br>
<span class="Statement">SED </span><a class="Constant" href="syntax.html#sed.vim" name="sed.vim">sed.vim</a> <a class="Constant" href="syntax.html#ft-sed-syntax" name="ft-sed-syntax">ft-sed-syntax</a><br>
<br>
To make tabs stand out from regular blanks (accomplished by using Todo<br>
highlighting on the tabs), define "highlight_sedtabs" by putting<br>
<br>
<div class="helpExample"> :let highlight_sedtabs = 1</div>
<br>
in the vimrc file. (This special highlighting only applies for tabs<br>
inside search patterns, replacement texts, addresses or text included<br>
by an Append/Change/Insert command.) If you enable this option, it is<br>
also a good idea to set the tab width to one character; by doing that,<br>
you can easily count the number of tabs in a string.<br>
<br>
Bugs:<br>
<br>
The transform command (y) is treated exactly like the substitute<br>
command. This means that, as far as this syntax file is concerned,<br>
transform accepts the same flags as substitute, which is wrong.<br>
(Transform accepts no flags.) I tolerate this bug because the<br>
involved commands need very complex treatment (95 patterns, one for<br>
each plausible pattern delimiter).<br>
<br>
<br>
<span class="Statement">SGML </span><a class="Constant" href="syntax.html#sgml.vim" name="sgml.vim">sgml.vim</a> <a class="Constant" href="syntax.html#ft-sgml-syntax" name="ft-sgml-syntax">ft-sgml-syntax</a><br>
<br>
The coloring scheme for tags in the SGML file works as follows.<br>
<br>
The <> of opening tags are colored differently than the </> of a closing tag.<br>
This is on purpose! For opening tags the 'Function' color is used, while for<br>
closing tags the 'Type' color is used (See syntax.vim to check how those are<br>
defined for you)<br>
<br>
Known tag names are colored the same way as statements in C. Unknown tag<br>
names are not colored which makes it easy to spot errors.<br>
<br>
<span class="Todo">Note</span> that the same is true for argument (or attribute) names. Known attribute<br>
names are colored differently than unknown ones.<br>
<br>
Some SGML tags are used to change the rendering of text. The following tags<br>
are recognized by the sgml.vim syntax coloring file and change the way normal<br>
text is shown: <span class="Special"><varname></span> <span class="Special"><emphasis></span> <span class="Special"><command></span> <span class="Special"><function></span> <span class="Special"><literal></span><br>
<span class="Special"><replaceable></span> <span class="Special"><ulink></span> and <span class="Special"><link></span>.<br>
<br>
If you want to change how such text is rendered, you must redefine the<br>
following syntax groups:<br>
<br>
- sgmlBold<br>
- sgmlBoldItalic<br>
- sgmlUnderline<br>
- sgmlItalic<br>
- sgmlLink for links<br>
<br>
To make this redefinition work you must redefine them all and define the<br>
following variable in your vimrc (this is due to the order in which the files<br>
are read during initialization)<br>
<div class="helpExample"> let sgml_my_rendering=1</div>
<br>
You can also disable this rendering by adding the following line to your<br>
vimrc file:<br>
<div class="helpExample"> let sgml_no_rendering=1</div>
<br>
(Adapted from the html.vim help text by Claudio Fleiner <claudio@fleiner.com>)<br>
<br>
<br>
<a class="Constant" href="syntax.html#ft-posix-synax" name="ft-posix-synax">ft-posix-synax</a> <a class="Constant" href="syntax.html#ft-dash-syntax" name="ft-dash-syntax">ft-dash-syntax</a><br>
<span class="Statement">SH </span><a class="Constant" href="syntax.html#sh.vim" name="sh.vim">sh.vim</a> <a class="Constant" href="syntax.html#ft-sh-syntax" name="ft-sh-syntax">ft-sh-syntax</a> <a class="Constant" href="syntax.html#ft-bash-syntax" name="ft-bash-syntax">ft-bash-syntax</a> <a class="Constant" href="syntax.html#ft-ksh-syntax" name="ft-ksh-syntax">ft-ksh-syntax</a><br>
<br>
This covers syntax highlighting for the older Unix (Bourne) sh, and newer<br>
shells such as bash, dash, posix, and the Korn shells.<br>
<br>
Vim attempts to determine which shell type is in use by specifying that<br>
various filenames are of specific types:<br>
<br>
<div class="helpExample"> ksh : .kshrc* *.ksh<br>
bash: .bashrc* bashrc bash.bashrc .bash_profile* *.bash</div>
<br>
If none of these cases pertain, then the first line of the file is examined<br>
(ex. looking for /bin/sh /bin/ksh /bin/bash). If the first line specifies a<br>
shelltype, then that shelltype is used. However some files (ex. .profile) are<br>
known to be shell files but the type is not apparent. Furthermore, on many<br>
systems sh is symbolically linked to "bash" (Linux, Windows+cygwin) or "ksh"<br>
(Posix).<br>
<br>
One may specify a global default by instantiating one of the following<br>
variables in your <.vimrc>:<br>
<br>
ksh:<br>
<div class="helpExample"> let g:is_kornshell = 1</div>
posix: (using this is the nearly the same as setting g:is_kornshell to 1)<br>
<div class="helpExample"> let g:is_posix = 1</div>
bash:<br>
<div class="helpExample"> let g:is_bash = 1</div>
sh: (default) Bourne shell<br>
<div class="helpExample"> let g:is_sh = 1</div>
<br>
(dash users should use posix)<br>
<br>
If there's no "#! ..." line, and the user hasn't availed himself/herself of a<br>
default sh.vim syntax setting as just shown, then syntax/sh.vim will assume<br>
the Bourne shell syntax. No need to quote RFCs or market penetration<br>
statistics in error reports, please -- just select the default version of the<br>
sh your system uses and install the associated "let..." in your <.vimrc>.<br>
<br>
The syntax/sh.vim file provides several levels of syntax-based folding:<br>
<br>
<div class="helpExample"> let g:sh_fold_enabled= 0 (default, no syntax folding)<br>
let g:sh_fold_enabled= 1 (enable function folding)<br>
let g:sh_fold_enabled= 2 (enable heredoc folding)<br>
let g:sh_fold_enabled= 4 (enable if/do/for folding)</div>
<br>
then various syntax items (ie. HereDocuments and function bodies) become<br>
syntax-foldable (see <a class="Identifier" href="syntax.html#:syn-fold">:syn-fold</a>). You also may add these together<br>
to get multiple types of folding:<br>
<br>
<div class="helpExample"> let g:sh_fold_enabled= 3 (enables function and heredoc folding)</div>
<br>
If you notice highlighting errors while scrolling backwards which are fixed<br>
when one redraws with <span class="Special">CTRL-L</span>, try setting the "sh_minlines" internal variable<br>
to a larger number. Example:<br>
<br>
<div class="helpExample"> let sh_minlines = 500</div>
<br>
This will make syntax synchronization start 500 lines before the first<br>
displayed line. The default value is 200. The disadvantage of using a larger<br>
number is that redrawing can become slow.<br>
<br>
If you don't have much to synchronize on, displaying can be very slow. To<br>
reduce this, the "sh_maxlines" internal variable can be set. Example:<br>
<br>
<div class="helpExample"> let sh_maxlines = 100</div>
<br>
The default is to use the twice sh_minlines. Set it to a smaller number to<br>
speed up displaying. The disadvantage is that highlight errors may appear.<br>
<br>
syntax/sh.vim tries to flag certain problems as errors; usually things like<br>
extra ']'s, <span class="MissingTag">'done'</span>s, <span class="MissingTag">'fi'</span>s, etc. If you find the error handling problematic<br>
for your purposes, you may suppress such error highlighting by putting<br>
the following line in your .vimrc:<br>
<br>
<div class="helpExample"> let g:sh_no_error= 1</div>
<br>
<br>
<a class="Constant" href="syntax.html#sh-embed" name="sh-embed">sh-embed</a> <a class="Constant" href="syntax.html#sh-awk" name="sh-awk">sh-awk</a><br>
<span class="PreProc">Sh: EMBEDDING LANGUAGES</span><br>
<br>
You may wish to embed languages into sh. I'll give an example courtesy of<br>
Lorance Stinson on how to do this with awk as an example. Put the following<br>
file into $HOME/.vim/after/syntax/sh/awkembed.vim:<br>
<br>
<div class="helpExample"> " AWK Embedding:<br>
" ==============<br>
" Shamelessly ripped from aspperl.vim by Aaron Hope.<br>
if exists("b:current_syntax")<br>
unlet b:current_syntax<br>
endif<br>
syn include @AWKScript syntax/awk.vim<br>
syn region AWKScriptCode matchgroup=AWKCommand start=+[=\\]\@<!'+ skip=+\\'+ end=+'+ contains=@AWKScript contained<br>
syn region AWKScriptEmbedded matchgroup=AWKCommand start=+\<awk\>+ skip=+\\$+ end=+[=\\]\@<!'+me=e-1 contains=@shIdList,@shExprList2 nextgroup=AWKScriptCode<br>
syn cluster shCommandSubList add=AWKScriptEmbedded<br>
hi def link AWKCommand Type</div>
<br>
This code will then let the awk code in the single quotes:<br>
<div class="helpExample"> awk '...awk code here...'</div>
be highlighted using the awk highlighting syntax. Clearly this may be<br>
extended to other languages.<br>
<br>
<br>
<span class="Statement">SPEEDUP </span><a class="Constant" href="syntax.html#spup.vim" name="spup.vim">spup.vim</a> <a class="Constant" href="syntax.html#ft-spup-syntax" name="ft-spup-syntax">ft-spup-syntax</a><br>
(AspenTech plant simulator)<br>
<br>
The Speedup syntax file has some options:<br>
<br>
- strict_subsections : If this variable is defined, only keywords for<br>
sections and subsections will be highlighted as statements but not<br>
other keywords (like WITHIN in the OPERATION section).<br>
<br>
- highlight_types : Definition of this variable causes stream types<br>
like temperature or pressure to be highlighted as Type, not as a<br>
plain Identifier. Included are the types that are usually found in<br>
the DECLARE section; if you defined own types, you have to include<br>
them in the syntax file.<br>
<br>
- oneline_comments : this value ranges from 1 to 3 and determines the<br>
highlighting of # style comments.<br>
<br>
oneline_comments = 1 : allow normal Speedup code after an even<br>
number of #s.<br>
<br>
oneline_comments = 2 : show code starting with the second # as<br>
error. This is the default setting.<br>
<br>
oneline_comments = 3 : show the whole line as error if it contains<br>
more than one #.<br>
<br>
Since especially OPERATION sections tend to become very large due to<br>
PRESETting variables, syncing may be critical. If your computer is<br>
fast enough, you can increase minlines and/or maxlines near the end of<br>
the syntax file.<br>
<br>
<br>
<span class="Statement">SQL </span><a class="Constant" href="syntax.html#sql.vim" name="sql.vim">sql.vim</a> <a class="Constant" href="syntax.html#ft-sql-syntax" name="ft-sql-syntax">ft-sql-syntax</a><br>
<a class="Constant" href="syntax.html#sqlinformix.vim" name="sqlinformix.vim">sqlinformix.vim</a> <a class="Constant" href="syntax.html#ft-sqlinformix-syntax" name="ft-sqlinformix-syntax">ft-sqlinformix-syntax</a><br>
<a class="Constant" href="syntax.html#sqlanywhere.vim" name="sqlanywhere.vim">sqlanywhere.vim</a> <a class="Constant" href="syntax.html#ft-sqlanywhere-syntax" name="ft-sqlanywhere-syntax">ft-sqlanywhere-syntax</a><br>
<br>
While there is an ANSI standard for SQL, most database engines add their own<br>
custom extensions. Vim currently supports the Oracle and Informix dialects of<br>
SQL. Vim assumes "*.sql" files are Oracle SQL by default.<br>
<br>
Vim currently has SQL support for a variety of different vendors via syntax<br>
scripts. You can change Vim's default from Oracle to any of the current SQL<br>
supported types. You can also easily alter the SQL dialect being used on a<br>
buffer by buffer basis.<br>
<br>
For more detailed instructions see <a class="Identifier" href="ft_sql.html">ft_sql.txt</a>.<br>
<br>
<br>
<span class="Statement">TCSH </span><a class="Constant" href="syntax.html#tcsh.vim" name="tcsh.vim">tcsh.vim</a> <a class="Constant" href="syntax.html#ft-tcsh-syntax" name="ft-tcsh-syntax">ft-tcsh-syntax</a><br>
<br>
This covers the shell named "tcsh". It is a superset of csh. See <a class="Identifier" href="syntax.html#csh.vim">csh.vim</a><br>
for how the filetype is detected.<br>
<br>
Tcsh does not allow \" in strings unless the "backslash_quote" shell variable<br>
is set. If you want VIM to assume that no backslash quote constructs exist add<br>
this line to your .vimrc:<br>
<br>
<div class="helpExample"> :let tcsh_backslash_quote = 0</div>
<br>
If you notice highlighting errors while scrolling backwards, which are fixed<br>
when redrawing with <span class="Special">CTRL-L</span>, try setting the "tcsh_minlines" internal variable<br>
to a larger number:<br>
<br>
<div class="helpExample"> :let tcsh_minlines = 1000</div>
<br>
This will make the syntax synchronization start 1000 lines before the first<br>
displayed line. If you set "tcsh_minlines" to "fromstart", then<br>
synchronization is done from the start of the file. The default value for<br>
tcsh_minlines is 100. The disadvantage of using a larger number is that<br>
redrawing can become slow.<br>
<br>
<br>
<span class="Statement">TEX </span><a class="Constant" href="syntax.html#tex.vim" name="tex.vim">tex.vim</a> <a class="Constant" href="syntax.html#ft-tex-syntax" name="ft-tex-syntax">ft-tex-syntax</a> <a class="Constant" href="syntax.html#latex-syntax" name="latex-syntax">latex-syntax</a><br>
<br>
<span class="PreProc">Tex Contents</span><br>
Tex: Want Syntax Folding? <a class="Identifier" href="syntax.html#tex-folding">tex-folding</a><br>
Tex: No Spell Checking Wanted <a class="Identifier" href="syntax.html#g:tex_nospell">g:tex_nospell</a><br>
Tex: Don't Want Spell Checking In Comments? <a class="Identifier" href="syntax.html#tex-nospell">tex-nospell</a><br>
Tex: Want Spell Checking in Verbatim Zones? <a class="Identifier" href="syntax.html#tex-verb">tex-verb</a><br>
Tex: Run-on Comments or MathZones <a class="Identifier" href="syntax.html#tex-runon">tex-runon</a><br>
Tex: Slow Syntax Highlighting? <a class="Identifier" href="syntax.html#tex-slow">tex-slow</a><br>
Tex: Want To Highlight More Commands? <a class="Identifier" href="syntax.html#tex-morecommands">tex-morecommands</a><br>
Tex: Excessive Error Highlighting? <a class="Identifier" href="syntax.html#tex-error">tex-error</a><br>
Tex: Need a new Math Group? <a class="Identifier" href="syntax.html#tex-math">tex-math</a><br>
Tex: Starting a New Style? <a class="Identifier" href="syntax.html#tex-style">tex-style</a><br>
Tex: Taking Advantage of Conceal Mode <a class="Identifier" href="syntax.html#tex-conceal">tex-conceal</a><br>
Tex: Selective Conceal Mode <a class="Identifier" href="syntax.html#g:tex_conceal">g:tex_conceal</a><br>
Tex: Controlling iskeyword <a class="Identifier" href="syntax.html#g:tex_isk">g:tex_isk</a><br>
Tex: Fine Subscript and Superscript Control <a class="Identifier" href="syntax.html#tex-supersub">tex-supersub</a><br>
<br>
<a class="Constant" href="syntax.html#tex-folding" name="tex-folding">tex-folding</a> <a class="Constant" href="syntax.html#g:tex_fold_enabled" name="g:tex_fold_enabled">g:tex_fold_enabled</a><br>
<span class="PreProc">Tex: Want Syntax Folding?</span><br>
<br>
As of version 28 of <syntax/tex.vim>, syntax-based folding of parts, chapters,<br>
sections, subsections, etc are supported. Put<br>
<div class="helpExample"> let g:tex_fold_enabled=1</div>
in your <.vimrc>, and :set fdm=syntax. I suggest doing the latter via a<br>
modeline at the end of your LaTeX file:<br>
<div class="helpExample"> % vim: fdm=syntax</div>
If your system becomes too slow, then you might wish to look into<br>
<div class="helpExample"> <a href="https://vimhelp.appspot.com/vim_faq.txt.html#faq-29.7">https://vimhelp.appspot.com/vim_faq.txt.html#faq-29.7</a></div>
<br>
<a class="Constant" href="syntax.html#g:tex_nospell" name="g:tex_nospell">g:tex_nospell</a><br>
<span class="PreProc">Tex: No Spell Checking Wanted</span><br>
<br>
If you don't want spell checking anywhere in your LaTeX document, put<br>
<div class="helpExample"> let g:tex_nospell=1</div>
into your .vimrc. If you merely wish to suppress spell checking inside<br>
comments only, see <a class="Identifier" href="syntax.html#g:tex_comment_nospell">g:tex_comment_nospell</a>.<br>
<br>
<a class="Constant" href="syntax.html#tex-nospell" name="tex-nospell">tex-nospell</a> <a class="Constant" href="syntax.html#g:tex_comment_nospell" name="g:tex_comment_nospell">g:tex_comment_nospell</a><br>
<span class="PreProc">Tex: Don't Want Spell Checking In Comments?</span><br>
<br>
Some folks like to include things like source code in comments and so would<br>
prefer that spell checking be disabled in comments in LaTeX files. To do<br>
this, put the following in your <.vimrc>:<br>
<div class="helpExample"> let g:tex_comment_nospell= 1</div>
If you want to suppress spell checking everywhere inside your LaTeX document,<br>
see <a class="Identifier" href="syntax.html#g:tex_nospell">g:tex_nospell</a>.<br>
<br>
<a class="Constant" href="syntax.html#tex-verb" name="tex-verb">tex-verb</a> <a class="Constant" href="syntax.html#g:tex_verbspell" name="g:tex_verbspell">g:tex_verbspell</a><br>
<span class="PreProc">Tex: Want Spell Checking in Verbatim Zones?</span><br>
<br>
Often verbatim regions are used for things like source code; seldom does<br>
one want source code spell-checked. However, for those of you who do<br>
want your verbatim zones spell-checked, put the following in your <.vimrc>:<br>
<div class="helpExample"> let g:tex_verbspell= 1</div>
<br>
<a class="Constant" href="syntax.html#tex-runon" name="tex-runon">tex-runon</a> <a class="Constant" href="syntax.html#tex-stopzone" name="tex-stopzone">tex-stopzone</a><br>
<span class="PreProc">Tex: Run-on Comments or MathZones</span><br>
<br>
The <syntax/tex.vim> highlighting supports TeX, LaTeX, and some AmsTeX. The<br>
highlighting supports three primary zones/regions: normal, texZone, and<br>
texMathZone. Although considerable effort has been made to have these zones<br>
terminate properly, zones delineated by $..$ and $$..$$ cannot be synchronized<br>
as there's no difference between start and end patterns. Consequently, a<br>
special "TeX comment" has been provided<br>
<div class="helpExample"> %stopzone</div>
which will forcibly terminate the highlighting of either a texZone or a<br>
texMathZone.<br>
<br>
<a class="Constant" href="syntax.html#tex-slow" name="tex-slow">tex-slow</a> <a class="Constant" href="syntax.html#tex-sync" name="tex-sync">tex-sync</a><br>
<span class="PreProc">Tex: Slow Syntax Highlighting?</span><br>
<br>
If you have a slow computer, you may wish to reduce the values for<br>
<div class="helpExample"> :syn sync maxlines=200<br>
:syn sync minlines=50</div>
(especially the latter). If your computer is fast, you may wish to<br>
increase them. This primarily affects synchronizing (i.e. just what group,<br>
if any, is the text at the top of the screen supposed to be in?).<br>
<br>
Another cause of slow highlighting is due to syntax-driven folding; see<br>
<a class="Identifier" href="syntax.html#tex-folding">tex-folding</a> for a way around this.<br>
<br>
<a class="Constant" href="syntax.html#g:tex_fast" name="g:tex_fast">g:tex_fast</a><br>
<br>
Finally, if syntax highlighting is still too slow, you may set<br>
<br>
<div class="helpExample"> :let g:tex_fast= ""</div>
<br>
in your .vimrc. Used this way, the g:tex_fast variable causes the syntax<br>
highlighting script to avoid defining any regions and associated<br>
synchronization. The result will be much faster syntax highlighting; the<br>
price: you will no longer have as much highlighting or any syntax-based<br>
folding, and you will be missing syntax-based error checking.<br>
<br>
You may decide that some syntax is acceptable; you may use the following table<br>
selectively to enable just some syntax highlighting:<br>
<br>
<div class="helpExample"> b : allow bold and italic syntax<br>
c : allow texComment syntax<br>
m : allow texMatcher syntax (ie. {...} and [...])<br>
M : allow texMath syntax<br>
p : allow parts, chapter, section, etc syntax<br>
r : allow texRefZone syntax (nocite, bibliography, label, pageref, eqref)<br>
s : allow superscript/subscript regions<br>
S : allow texStyle syntax<br>
v : allow verbatim syntax<br>
V : allow texNewEnv and texNewCmd syntax</div>
<br>
As an example, let g:tex_fast= "M" will allow math-associated highlighting<br>
but suppress all the other region-based syntax highlighting.<br>
(also see: <a class="Identifier" href="syntax.html#g:tex_conceal">g:tex_conceal</a> and <a class="Identifier" href="syntax.html#tex-supersub">tex-supersub</a>)<br>
<br>
<a class="Constant" href="syntax.html#tex-morecommands" name="tex-morecommands">tex-morecommands</a> <a class="Constant" href="syntax.html#tex-package" name="tex-package">tex-package</a><br>
<span class="PreProc">Tex: Want To Highlight More Commands?</span><br>
<br>
LaTeX is a programmable language, and so there are thousands of packages full<br>
of specialized LaTeX commands, syntax, and fonts. If you're using such a<br>
package you'll often wish that the distributed syntax/tex.vim would support<br>
it. However, clearly this is impractical. So please consider using the<br>
techniques in <a class="Identifier" href="syntax.html#mysyntaxfile-add">mysyntaxfile-add</a> to extend or modify the highlighting provided<br>
by syntax/tex.vim. Please consider uploading any extensions that you write,<br>
which typically would go in $HOME/after/syntax/tex/[pkgname].vim, to<br>
<span class="Constant"><a href="http://vim.sf.net/">http://vim.sf.net/</a></span>.<br>
<br>
<a class="Constant" href="syntax.html#tex-error" name="tex-error">tex-error</a> <a class="Constant" href="syntax.html#g:tex_no_error" name="g:tex_no_error">g:tex_no_error</a><br>
<span class="PreProc">Tex: Excessive Error Highlighting?</span><br>
<br>
The <tex.vim> supports lexical error checking of various sorts. Thus,<br>
although the error checking is ofttimes very useful, it can indicate<br>
errors where none actually are. If this proves to be a problem for you,<br>
you may put in your <.vimrc> the following statement:<br>
<div class="helpExample"> let g:tex_no_error=1</div>
and all error checking by <syntax/tex.vim> will be suppressed.<br>
<br>
<a class="Constant" href="syntax.html#tex-math" name="tex-math">tex-math</a><br>
<span class="PreProc">Tex: Need a new Math Group?</span><br>
<br>
If you want to include a new math group in your LaTeX, the following<br>
code shows you an example as to how you might do so:<br>
<div class="helpExample"> call TexNewMathZone(sfx,mathzone,starform)</div>
You'll want to provide the new math group with a unique suffix<br>
(currently, A-L and V-Z are taken by <syntax/tex.vim> itself).<br>
As an example, consider how eqnarray is set up by <syntax/tex.vim>:<br>
<div class="helpExample"> call TexNewMathZone("D","eqnarray",1)</div>
You'll need to change "mathzone" to the name of your new math group,<br>
and then to the call to it in .vim/after/syntax/tex.vim.<br>
The "starform" variable, if true, implies that your new math group<br>
has a starred form (ie. eqnarray*).<br>
<br>
<a class="Constant" href="syntax.html#tex-style" name="tex-style">tex-style</a> <a class="Constant" href="syntax.html#b:tex_stylish" name="b:tex_stylish">b:tex_stylish</a><br>
<span class="PreProc">Tex: Starting a New Style?</span><br>
<br>
One may use "\makeatletter" in *.tex files, thereby making the use of "@" in<br>
commands available. However, since the *.tex file doesn't have one of the<br>
following suffices: sty cls clo dtx ltx, the syntax highlighting will flag<br>
such use of @ as an error. To solve this:<br>
<br>
<div class="helpExample"> :let b:tex_stylish = 1<br>
:set ft=tex</div>
<br>
Putting "let g:tex_stylish=1" into your <.vimrc> will make <syntax/tex.vim><br>
always accept such use of @.<br>
<br>
<a class="Constant" href="syntax.html#tex-cchar" name="tex-cchar">tex-cchar</a> <a class="Constant" href="syntax.html#tex-cole" name="tex-cole">tex-cole</a> <a class="Constant" href="syntax.html#tex-conceal" name="tex-conceal">tex-conceal</a><br>
<span class="PreProc">Tex: Taking Advantage of Conceal Mode</span><br>
<br>
If you have <a class="Identifier" href="options.html#'conceallevel'">'conceallevel'</a> set to 2 and if your encoding is utf-8, then a<br>
number of character sequences can be translated into appropriate utf-8 glyphs,<br>
including various accented characters, Greek characters in MathZones, and<br>
superscripts and subscripts in MathZones. Not all characters can be made into<br>
superscripts or subscripts; the constraint is due to what utf-8 supports.<br>
In fact, only a few characters are supported as subscripts.<br>
<br>
One way to use this is to have vertically split windows (see <a class="Identifier" href="windows.html#CTRL-W_v">CTRL-W_v</a>); one<br>
with <a class="Identifier" href="options.html#'conceallevel'">'conceallevel'</a> at 0 and the other at 2; and both using <a class="Identifier" href="options.html#'scrollbind'">'scrollbind'</a>.<br>
<br>
<a class="Constant" href="syntax.html#g:tex_conceal" name="g:tex_conceal">g:tex_conceal</a><br>
<span class="PreProc">Tex: Selective Conceal Mode</span><br>
<br>
You may selectively use conceal mode by setting g:tex_conceal in your<br>
<.vimrc>. By default, g:tex_conceal is set to "admgs" to enable concealment<br>
for the following sets of characters:<br>
<br>
<div class="helpExample"> a = accents/ligatures<br>
b = bold and italic<br>
d = delimiters<br>
m = math symbols<br>
g = Greek<br>
s = superscripts/subscripts</div>
<br>
By leaving one or more of these out, the associated conceal-character<br>
substitution will not be made.<br>
<br>
<a class="Constant" href="syntax.html#g:tex_isk" name="g:tex_isk">g:tex_isk</a> <a class="Constant" href="syntax.html#g:tex_stylish" name="g:tex_stylish">g:tex_stylish</a><br>
<span class="PreProc">Tex: Controlling iskeyword</span><br>
<br>
Normally, LaTeX keywords support 0-9, a-z, A-z, and 192-255 only. Latex<br>
keywords don't support the underscore - except when in *.sty files. The<br>
syntax highlighting script handles this with the following logic:<br>
<br>
* If g:tex_stylish exists and is 1<br>
then the file will be treated as a "sty" file, so the "_"<br>
will be allowed as part of keywords<br>
(regardless of g:tex_isk)<br>
* Else if the file's suffix is sty, cls, clo, dtx, or ltx,<br>
then the file will be treated as a "sty" file, so the "_"<br>
will be allowed as part of keywords<br>
(regardless of g:tex_isk)<br>
<br>
* If g:tex_isk exists, then it will be used for the local <a class="Type" href="options.html#'iskeyword'">'iskeyword'</a><br>
* Else the local <a class="Type" href="options.html#'iskeyword'">'iskeyword'</a> will be set to 48-57,a-z,A-Z,192-255<br>
<br>
<a class="Constant" href="syntax.html#tex-supersub" name="tex-supersub">tex-supersub</a> <a class="Constant" href="syntax.html#g:tex_superscripts" name="g:tex_superscripts">g:tex_superscripts</a> <a class="Constant" href="syntax.html#g:tex_subscripts" name="g:tex_subscripts">g:tex_subscripts</a><br>
<span class="PreProc">Tex: Fine Subscript and Superscript Control</span><br>
<br>
See <a class="Identifier" href="syntax.html#tex-conceal">tex-conceal</a> for how to enable concealed character replacement.<br>
<br>
See <a class="Identifier" href="syntax.html#g:tex_conceal">g:tex_conceal</a> for selectively concealing accents, bold/italic,<br>
math, Greek, and superscripts/subscripts.<br>
<br>
One may exert fine control over which superscripts and subscripts one<br>
wants syntax-based concealment for (see <a class="Identifier" href="syntax.html#:syn-cchar">:syn-cchar</a>). Since not all<br>
fonts support all characters, one may override the<br>
concealed-replacement lists; by default these lists are given by:<br>
<br>
<div class="helpExample"> let g:tex_superscripts= "[0-9a-zA-W.,:;+-<>/()=]"<br>
let g:tex_subscripts= "[0-9aehijklmnoprstuvx,+-/().]"</div>
<br>
For example, I use Luxi Mono Bold; it doesn't support subscript<br>
characters for "hklmnpst", so I put<br>
<div class="helpExample"> let g:tex_subscripts= "[0-9aeijoruvx,+-/().]"</div>
in ~/.vim/ftplugin/tex/tex.vim in order to avoid having inscrutable<br>
utf-8 glyphs appear.<br>
<br>
<br>
<span class="Statement">TF </span><a class="Constant" href="syntax.html#tf.vim" name="tf.vim">tf.vim</a> <a class="Constant" href="syntax.html#ft-tf-syntax" name="ft-tf-syntax">ft-tf-syntax</a><br>
<br>
There is one option for the tf syntax highlighting.<br>
<br>
For syncing, minlines defaults to 100. If you prefer another value, you can<br>
set "tf_minlines" to the value you desire. Example:<br>
<br>
<div class="helpExample"> :let tf_minlines = your choice</div>
<br>
<span class="Statement">VIM </span><a class="Constant" href="syntax.html#vim.vim" name="vim.vim">vim.vim</a> <a class="Constant" href="syntax.html#ft-vim-syntax" name="ft-vim-syntax">ft-vim-syntax</a><br>
<a class="Constant" href="syntax.html#g:vimsyn_minlines" name="g:vimsyn_minlines">g:vimsyn_minlines</a> <a class="Constant" href="syntax.html#g:vimsyn_maxlines" name="g:vimsyn_maxlines">g:vimsyn_maxlines</a><br>
There is a trade-off between more accurate syntax highlighting versus screen<br>
updating speed. To improve accuracy, you may wish to increase the<br>
g:vimsyn_minlines variable. The g:vimsyn_maxlines variable may be used to<br>
improve screen updating rates (see <a class="Identifier" href="syntax.html#:syn-sync">:syn-sync</a> for more on this).<br>
<br>
<div class="helpExample"> g:vimsyn_minlines : used to set synchronization minlines<br>
g:vimsyn_maxlines : used to set synchronization maxlines</div>
<br>
(g:vim_minlines and g:vim_maxlines are deprecated variants of<br>
these two options)<br>
<br>
<a class="Constant" href="syntax.html#g:vimsyn_embed" name="g:vimsyn_embed">g:vimsyn_embed</a><br>
The g:vimsyn_embed option allows users to select what, if any, types of<br>
embedded script highlighting they wish to have.<br>
<br>
<div class="helpExample"> g:vimsyn_embed == 0 : don't support any embedded scripts<br>
g:vimsyn_embed =~ 'l' : support embedded lua<br>
g:vimsyn_embed =~ 'm' : support embedded mzscheme<br>
g:vimsyn_embed =~ 'p' : support embedded perl<br>
g:vimsyn_embed =~ 'P' : support embedded python<br>
g:vimsyn_embed =~ 'r' : support embedded ruby<br>
g:vimsyn_embed =~ 't' : support embedded tcl</div>
<br>
By default, g:vimsyn_embed is a string supporting interpreters that your vim<br>
itself supports. Concatenate multiple characters to support multiple types<br>
of embedded interpreters; ie. g:vimsyn_embed= "mp" supports embedded mzscheme<br>
and embedded perl.<br>
<a class="Constant" href="syntax.html#g:vimsyn_folding" name="g:vimsyn_folding">g:vimsyn_folding</a><br>
<br>
Some folding is now supported with syntax/vim.vim:<br>
<br>
<div class="helpExample"> g:vimsyn_folding == 0 or doesn't exist: no syntax-based folding<br>
g:vimsyn_folding =~ 'a' : augroups<br>
g:vimsyn_folding =~ 'f' : fold functions<br>
g:vimsyn_folding =~ 'l' : fold lua script<br>
g:vimsyn_folding =~ 'm' : fold mzscheme script<br>
g:vimsyn_folding =~ 'p' : fold perl script<br>
g:vimsyn_folding =~ 'P' : fold python script<br>
g:vimsyn_folding =~ 'r' : fold ruby script<br>
g:vimsyn_folding =~ 't' : fold tcl script</div>
<br>
<a class="Constant" href="syntax.html#g:vimsyn_noerror" name="g:vimsyn_noerror">g:vimsyn_noerror</a><br>
Not all error highlighting that syntax/vim.vim does may be correct; Vim script<br>
is a difficult language to highlight correctly. A way to suppress error<br>
highlighting is to put the following line in your <a class="Identifier" href="starting.html#vimrc">vimrc</a>:<br>
<br>
<div class="helpExample"> let g:vimsyn_noerror = 1</div>
<br>
<br>
<br>
<span class="Statement">XF86CONFIG </span><a class="Constant" href="syntax.html#xf86conf.vim" name="xf86conf.vim">xf86conf.vim</a> <a class="Constant" href="syntax.html#ft-xf86conf-syntax" name="ft-xf86conf-syntax">ft-xf86conf-syntax</a><br>
<br>
The syntax of XF86Config file differs in XFree86 v3.x and v4.x. Both<br>
variants are supported. Automatic detection is used, but is far from perfect.<br>
You may need to specify the version manually. Set the variable<br>
xf86conf_xfree86_version to 3 or 4 according to your XFree86 version in<br>
your .vimrc. Example:<br>
<div class="helpExample"> :let xf86conf_xfree86_version=3</div>
When using a mix of versions, set the b:xf86conf_xfree86_version variable.<br>
<br>
<span class="Todo">Note</span> that spaces and underscores in option names are not supported. Use<br>
"SyncOnGreen" instead of "__s yn con gr_e_e_n" if you want the option name<br>
highlighted.<br>
<br>
<br>
<span class="Statement">XML </span><a class="Constant" href="syntax.html#xml.vim" name="xml.vim">xml.vim</a> <a class="Constant" href="syntax.html#ft-xml-syntax" name="ft-xml-syntax">ft-xml-syntax</a><br>
<br>
Xml namespaces are highlighted by default. This can be inhibited by<br>
setting a global variable:<br>
<br>
<div class="helpExample"> :let g:xml_namespace_transparent=1</div>
<br>
<a class="Constant" href="syntax.html#xml-folding" name="xml-folding">xml-folding</a><br>
The xml syntax file provides syntax <a class="Identifier" href="fold.html#folding">folding</a> (see <a class="Identifier" href="syntax.html#:syn-fold">:syn-fold</a>) between<br>
start and end tags. This can be turned on by<br>
<br>
<div class="helpExample"> :let g:xml_syntax_folding = 1<br>
:set foldmethod=syntax</div>
<br>
<span class="Todo">Note</span>: syntax folding might slow down syntax highlighting significantly,<br>
especially for large files.<br>
<br>
<br>
X Pixmaps (XPM) <a class="Constant" href="syntax.html#xpm.vim" name="xpm.vim">xpm.vim</a> <a class="Constant" href="syntax.html#ft-xpm-syntax" name="ft-xpm-syntax">ft-xpm-syntax</a><br>
<br>
xpm.vim creates its syntax items dynamically based upon the contents of the<br>
XPM file. Thus if you make changes e.g. in the color specification strings,<br>
you have to source it again e.g. with ":set syn=xpm".<br>
<br>
To copy a pixel with one of the colors, yank a "pixel" with "yl" and insert it<br>
somewhere else with "P".<br>
<br>
Do you want to draw with the mouse? Try the following:<br>
<div class="helpExample"> :function! GetPixel()<br>
: let c = getline(".")[col(".") - 1]<br>
: echo c<br>
: exe "noremap <LeftMouse> <LeftMouse>r".c<br>
: exe "noremap <LeftDrag> <LeftMouse>r".c<br>
:endfunction<br>
:noremap <RightMouse> <LeftMouse>:call GetPixel()<CR><br>
:set guicursor=n:hor20 " to see the color beneath the cursor</div>
This turns the right button into a pipette and the left button into a pen.<br>
It will work with XPM files that have one character per pixel only and you<br>
must not click outside of the pixel strings, but feel free to improve it.<br>
<br>
It will look much better with a font in a quadratic cell size, e.g. for X:<br>
<div class="helpExample"> :set guifont=-*-clean-medium-r-*-*-8-*-*-*-*-80-*</div>
<br>
<br>
<span class="Statement">YAML </span><a class="Constant" href="syntax.html#yaml.vim" name="yaml.vim">yaml.vim</a> <a class="Constant" href="syntax.html#ft-yaml-syntax" name="ft-yaml-syntax">ft-yaml-syntax</a><br>
<br>
<a class="Constant" href="syntax.html#g:yaml_schema" name="g:yaml_schema">g:yaml_schema</a> <a class="Constant" href="syntax.html#b:yaml_schema" name="b:yaml_schema">b:yaml_schema</a><br>
A YAML schema is a combination of a set of tags and a mechanism for resolving <br>
non-specific tags. For user this means that YAML parser may, depending on <br>
plain scalar contents, treat plain scalar (which can actually be only string <br>
and nothing else) as a value of the other type: null, boolean, floating-point, <br>
integer. <a class="Comment" href="syntax.html#g:yaml_schema">g:yaml_schema</a> option determines according to which schema values <br>
will be highlighted specially. Supported schemas are<br>
<br>
<span class="PreProc">Schema Description</span><br>
failsafe No additional highlighting.<br>
json Supports JSON-style numbers, booleans and null.<br>
core Supports more number, boolean and null styles.<br>
pyyaml In addition to core schema supports highlighting timestamps, <br>
but there are some differences in what is recognized as <br>
numbers and many additional boolean values not present in core <br>
schema.<br>
<br>
Default schema is <span class="Comment">core</span>.<br>
<br>
<span class="Todo">Note</span> that schemas are not actually limited to plain scalars, but this is the <br>
only difference between schemas defined in YAML specification and the only <br>
difference defined in the syntax file.<br>
<br>
<br>
<span class="Statement">ZSH </span><a class="Constant" href="syntax.html#zsh.vim" name="zsh.vim">zsh.vim</a> <a class="Constant" href="syntax.html#ft-zsh-syntax" name="ft-zsh-syntax">ft-zsh-syntax</a><br>
<br>
The syntax script for zsh allows for syntax-based folding:<br>
<br>
<div class="helpExample"> :let g:zsh_fold_enable = 1</div>
<br>
<span class="PreProc">==============================================================================</span><br>
5. Defining a syntax <a class="Constant" href="syntax.html#:syn-define" name=":syn-define">:syn-define</a> <a class="Constant" href="syntax.html#E410" name="E410">E410</a><br>
<br>
Vim understands three types of syntax items:<br>
<br>
1. Keyword<br>
It can only contain keyword characters, according to the <a class="Type" href="options.html#'iskeyword'">'iskeyword'</a><br>
option. It cannot contain other syntax items. It will only match with a<br>
complete word (there are no keyword characters before or after the match).<br>
The keyword "if" would match in "if(a=b)", but not in "ifdef x", because<br>
"(" is not a keyword character and "d" is.<br>
<br>
2. Match<br>
This is a match with a single regexp pattern.<br>
<br>
3. Region<br>
This starts at a match of the "start" regexp pattern and ends with a match<br>
with the "end" regexp pattern. Any other text can appear in between. A<br>
"skip" regexp pattern can be used to avoid matching the "end" pattern.<br>
<br>
Several syntax ITEMs can be put into one syntax GROUP. For a syntax group<br>
you can give highlighting attributes. For example, you could have an item<br>
to define a "/* .. */" comment and another one that defines a "// .." comment,<br>
and put them both in the "Comment" group. You can then specify that a<br>
"Comment" will be in bold font and have a blue color. You are free to make<br>
one highlight group for one syntax item, or put all items into one group.<br>
This depends on how you want to specify your highlighting attributes. Putting<br>
each item in its own group results in having to specify the highlighting<br>
for a lot of groups.<br>
<br>
<span class="Todo">Note</span> that a syntax group and a highlight group are similar. For a highlight<br>
group you will have given highlight attributes. These attributes will be used<br>
for the syntax group with the same name.<br>
<br>
In case more than one item matches at the same position, the one that was<br>
defined LAST wins. Thus you can override previously defined syntax items by<br>
using an item that matches the same text. But a keyword always goes before a<br>
match or region. And a keyword with matching case always goes before a<br>
keyword with ignoring case.<br>
<br>
<br>
<span class="Statement">PRIORITY </span><a class="Constant" href="syntax.html#:syn-priority" name=":syn-priority">:syn-priority</a><br>
<br>
When several syntax items may match, these rules are used:<br>
<br>
1. When multiple Match or Region items start in the same position, the item<br>
defined last has priority.<br>
2. A Keyword has priority over Match and Region items.<br>
3. An item that starts in an earlier position has priority over items that<br>
start in later positions.<br>
<br>
<br>
<span class="Statement">DEFINING CASE </span><a class="Constant" href="syntax.html#:syn-case" name=":syn-case">:syn-case</a> <a class="Constant" href="syntax.html#E390" name="E390">E390</a><br>
<br>
:sy[ntax] case [match | ignore]<br>
This defines if the following ":syntax" commands will work with<br>
matching case, when using "match", or with ignoring case, when using<br>
"ignore". <span class="Todo">Note</span> that any items before this are not affected, and all<br>
items until the next ":syntax case" command are affected.<br>
<br>
:sy[ntax] case<br>
Show either "syntax case match" or "syntax case ignore" (translated).<br>
<br>
<span class="Statement">SPELL CHECKING </span><a class="Constant" href="syntax.html#:syn-spell" name=":syn-spell">:syn-spell</a><br>
<br>
:sy[ntax] spell [toplevel | notoplevel | default]<br>
This defines where spell checking is to be done for text that is not<br>
in a syntax item:<br>
<br>
toplevel: Text is spell checked.<br>
notoplevel: Text is not spell checked.<br>
default: When there is a @Spell cluster no spell checking.<br>
<br>
For text in syntax items use the @Spell and @NoSpell clusters<br>
<a class="Identifier" href="spell.html#spell-syntax">spell-syntax</a>. When there is no @Spell and no @NoSpell cluster then<br>
spell checking is done for "default" and "toplevel".<br>
<br>
To activate spell checking the <a class="Type" href="options.html#'spell'">'spell'</a> option must be set.<br>
<br>
:sy[ntax] spell<br>
Show either "syntax spell toplevel", "syntax spell notoplevel" or<br>
"syntax spell default" (translated).<br>
<br>
<br>
<span class="Statement">SYNTAX ISKEYWORD SETTING </span><a class="Constant" href="syntax.html#:syn-iskeyword" name=":syn-iskeyword">:syn-iskeyword</a><br>
<br>
:sy[ntax] iskeyword [clear | <span class="Special">{option}</span>]<br>
This defines the keyword characters. It's like the <a class="Type" href="options.html#'iskeyword'">'iskeyword'</a> option<br>
for but only applies to syntax highlighting.<br>
<br>
clear: Syntax specific iskeyword setting is disabled and the<br>
buffer-local <a class="Type" href="options.html#'iskeyword'">'iskeyword'</a> setting is used.<br>
<span class="Special">{option}</span> Set the syntax <a class="Type" href="options.html#'iskeyword'">'iskeyword'</a> option to a new value. <br>
<br>
Example:<br>
<div class="helpExample"> :syntax iskeyword @,48-57,192-255,$,_</div>
<br>
This would set the syntax specific iskeyword option to include all<br>
alphabetic characters, plus the numeric characters, all accented<br>
characters and also includes the "_" and the "$".<br>
<br>
If no argument is given, the current value will be output.<br>
<br>
Setting this option influences what <a class="Identifier" href="pattern.html#/\k">/\k</a> matches in syntax patterns<br>
and also determines where <a class="Identifier" href="syntax.html#:syn-keyword">:syn-keyword</a> will be checked for a new<br>
match.<br>
<br>
It is recommended when writing syntax files, to use this command to<br>
set the correct value for the specific syntax language and not change<br>
the <a class="Type" href="options.html#'iskeyword'">'iskeyword'</a> option.<br>
<br>
<span class="Statement">DEFINING KEYWORDS </span><a class="Constant" href="syntax.html#:syn-keyword" name=":syn-keyword">:syn-keyword</a><br>
<br>
:sy[ntax] keyword <span class="Special">{group-name}</span> [<span class="Special">{options}</span>] <span class="Special">{keyword}</span> .. [<span class="Special">{options}</span>]<br>
<br>
This defines a number of keywords.<br>
<br>
<span class="Special">{group-name}</span> Is a syntax group name such as "Comment".<br>
[<span class="Special">{options}</span>] See <a class="Identifier" href="syntax.html#:syn-arguments">:syn-arguments</a> below.<br>
<span class="Special">{keyword}</span> .. Is a list of keywords which are part of this group.<br>
<br>
Example:<br>
<div class="helpExample"> :syntax keyword Type int long char</div>
<br>
The <span class="Special">{options}</span> can be given anywhere in the line. They will apply to<br>
all keywords given, also for options that come after a keyword.<br>
These examples do exactly the same:<br>
<div class="helpExample"> :syntax keyword Type contained int long char<br>
:syntax keyword Type int long contained char<br>
:syntax keyword Type int long char contained</div>
<a class="Constant" href="syntax.html#E789" name="E789">E789</a> <a class="Constant" href="syntax.html#E890" name="E890">E890</a><br>
When you have a keyword with an optional tail, like Ex commands in<br>
Vim, you can put the optional characters inside [], to define all the<br>
variations at once:<br>
<div class="helpExample"> :syntax keyword vimCommand ab[breviate] n[ext]</div>
<br>
Don't forget that a keyword can only be recognized if all the<br>
characters are included in the <a class="Type" href="options.html#'iskeyword'">'iskeyword'</a> option. If one character<br>
isn't, the keyword will never be recognized.<br>
Multi-byte characters can also be used. These do not have to be in<br>
<a class="Type" href="options.html#'iskeyword'">'iskeyword'</a>.<br>
See <a class="Identifier" href="syntax.html#:syn-iskeyword">:syn-iskeyword</a> for defining syntax specific iskeyword settings.<br>
<br>
A keyword always has higher priority than a match or region, the<br>
keyword is used if more than one item matches. Keywords do not nest<br>
and a keyword can't contain anything else.<br>
<br>
<span class="Todo">Note</span> that when you have a keyword that is the same as an option (even<br>
one that isn't allowed here), you can not use it. Use a match<br>
instead.<br>
<br>
The maximum length of a keyword is 80 characters.<br>
<br>
The same keyword can be defined multiple times, when its containment<br>
differs. For example, you can define the keyword once not contained<br>
and use one highlight group, and once contained, and use a different<br>
highlight group. Example:<br>
<div class="helpExample"> :syn keyword vimCommand tag<br>
:syn keyword vimSetting contained tag</div>
When finding "tag" outside of any syntax item, the "vimCommand"<br>
highlight group is used. When finding "tag" in a syntax item that<br>
contains "vimSetting", the "vimSetting" group is used.<br>
<br>
<br>
<span class="Statement">DEFINING MATCHES </span><a class="Constant" href="syntax.html#:syn-match" name=":syn-match">:syn-match</a><br>
<br>
:sy[ntax] match <span class="Special">{group-name}</span> [<span class="Special">{options}</span>]<br>
<span class="Special">[excludenl]</span><br>
<span class="Special">[keepend]</span><br>
<span class="Special">{pattern}</span><br>
[<span class="Special">{options}</span>]<br>
<br>
This defines one match.<br>
<br>
<span class="Special">{group-name}</span> A syntax group name such as "Comment".<br>
[<span class="Special">{options}</span>] See <a class="Identifier" href="syntax.html#:syn-arguments">:syn-arguments</a> below.<br>
<span class="Special">[excludenl]</span> Don't make a pattern with the end-of-line "$"<br>
extend a containing match or region. Must be<br>
given before the pattern. <a class="Identifier" href="syntax.html#:syn-excludenl">:syn-excludenl</a><br>
keepend Don't allow contained matches to go past a<br>
match with the end pattern. See<br>
<a class="Identifier" href="syntax.html#:syn-keepend">:syn-keepend</a>.<br>
<span class="Special">{pattern}</span> The search pattern that defines the match.<br>
See <a class="Identifier" href="syntax.html#:syn-pattern">:syn-pattern</a> below.<br>
<span class="Todo">Note</span> that the pattern may match more than one<br>
line, which makes the match depend on where<br>
Vim starts searching for the pattern. You<br>
need to make sure syncing takes care of this.<br>
<br>
Example (match a character constant):<br>
<div class="helpExample"> :syntax match Character /'.'/hs=s+1,he=e-1</div>
<br>
<br>
<span class="Statement">DEFINING REGIONS </span><a class="Constant" href="syntax.html#:syn-region" name=":syn-region">:syn-region</a> <a class="Constant" href="syntax.html#:syn-start" name=":syn-start">:syn-start</a> <a class="Constant" href="syntax.html#:syn-skip" name=":syn-skip">:syn-skip</a> <a class="Constant" href="syntax.html#:syn-end" name=":syn-end">:syn-end</a><br>
<a class="Constant" href="syntax.html#E398" name="E398">E398</a> <a class="Constant" href="syntax.html#E399" name="E399">E399</a><br>
:sy[ntax] region <span class="Special">{group-name}</span> [<span class="Special">{options}</span>]<br>
[matchgroup=<span class="Special">{group-name}</span>]<br>
<span class="Special">[keepend]</span><br>
<span class="Special">[extend]</span><br>
<span class="Special">[excludenl]</span><br>
start={start_pattern} ..<br>
[skip={skip_pattern}]<br>
end={end_pattern} ..<br>
[<span class="Special">{options}</span>]<br>
<br>
This defines one region. It may span several lines.<br>
<br>
<span class="Special">{group-name}</span> A syntax group name such as "Comment".<br>
[<span class="Special">{options}</span>] See <a class="Identifier" href="syntax.html#:syn-arguments">:syn-arguments</a> below.<br>
[matchgroup=<span class="Special">{group-name}</span>] The syntax group to use for the following<br>
start or end pattern matches only. Not used<br>
for the text in between the matched start and<br>
end patterns. Use NONE to reset to not using<br>
a different group for the start or end match.<br>
See <a class="Identifier" href="syntax.html#:syn-matchgroup">:syn-matchgroup</a>.<br>
keepend Don't allow contained matches to go past a<br>
match with the end pattern. See<br>
<a class="Identifier" href="syntax.html#:syn-keepend">:syn-keepend</a>.<br>
extend Override a "keepend" for an item this region<br>
is contained in. See <a class="Identifier" href="syntax.html#:syn-extend">:syn-extend</a>.<br>
excludenl Don't make a pattern with the end-of-line "$"<br>
extend a containing match or item. Only<br>
useful for end patterns. Must be given before<br>
the patterns it applies to. <a class="Identifier" href="syntax.html#:syn-excludenl">:syn-excludenl</a><br>
start={start_pattern} The search pattern that defines the start of<br>
the region. See <a class="Identifier" href="syntax.html#:syn-pattern">:syn-pattern</a> below.<br>
skip={skip_pattern} The search pattern that defines text inside<br>
the region where not to look for the end<br>
pattern. See <a class="Identifier" href="syntax.html#:syn-pattern">:syn-pattern</a> below.<br>
end={end_pattern} The search pattern that defines the end of<br>
the region. See <a class="Identifier" href="syntax.html#:syn-pattern">:syn-pattern</a> below.<br>
<br>
Example:<br>
<div class="helpExample"> :syntax region String start=+"+ skip=+\\"+ end=+"+</div>
<br>
The start/skip/end patterns and the options can be given in any order.<br>
There can be zero or one skip pattern. There must be one or more<br>
start and end patterns. This means that you can omit the skip<br>
pattern, but you must give at least one start and one end pattern. It<br>
is allowed to have white space before and after the equal sign<br>
(although it mostly looks better without white space).<br>
<br>
When more than one start pattern is given, a match with one of these<br>
is sufficient. This means there is an OR relation between the start<br>
patterns. The last one that matches is used. The same is true for<br>
the end patterns.<br>
<br>
The search for the end pattern starts right after the start pattern.<br>
Offsets are not used for this. This implies that the match for the<br>
end pattern will never overlap with the start pattern.<br>
<br>
The skip and end pattern can match across line breaks, but since the<br>
search for the pattern can start in any line it often does not do what<br>
you want. The skip pattern doesn't avoid a match of an end pattern in<br>
the next line. Use single-line patterns to avoid trouble.<br>
<br>
<span class="Todo">Note</span>: The decision to start a region is only based on a matching start<br>
pattern. There is no check for a matching end pattern. This does NOT<br>
work:<br>
<div class="helpExample"> :syn region First start="(" end=":"<br>
:syn region Second start="(" end=";"</div>
The Second always matches before the First (last defined pattern has<br>
higher priority). The Second region then continues until the next<br>
';', no matter if there is a ':' before it. Using a match does work:<br>
<div class="helpExample"> :syn match First "(\_.\{-}:"<br>
:syn match Second "(\_.\{-};"</div>
This pattern matches any character or line break with "\_." and<br>
repeats that with "\<span class="Special">{-}</span>" (repeat as few as possible).<br>
<br>
<a class="Constant" href="syntax.html#:syn-keepend" name=":syn-keepend">:syn-keepend</a><br>
By default, a contained match can obscure a match for the end pattern.<br>
This is useful for nesting. For example, a region that starts with<br>
"{" and ends with "}", can contain another region. An encountered "}"<br>
will then end the contained region, but not the outer region:<br>
{ starts outer "{}" region<br>
{ starts contained "{}" region<br>
} ends contained "{}" region<br>
} ends outer "{} region<br>
If you don't want this, the "keepend" argument will make the matching<br>
of an end pattern of the outer region also end any contained item.<br>
This makes it impossible to nest the same region, but allows for<br>
contained items to highlight parts of the end pattern, without causing<br>
that to skip the match with the end pattern. Example:<br>
<div class="helpExample"> :syn match vimComment +"[^"]\+$+<br>
:syn region vimCommand start="set" end="$" contains=vimComment keepend</div>
The "keepend" makes the vimCommand always end at the end of the line,<br>
even though the contained vimComment includes a match with the <span class="Special"><EOL></span>.<br>
<br>
When "keepend" is not used, a match with an end pattern is retried<br>
after each contained match. When "keepend" is included, the first<br>
encountered match with an end pattern is used, truncating any<br>
contained matches.<br>
<a class="Constant" href="syntax.html#:syn-extend" name=":syn-extend">:syn-extend</a><br>
The "keepend" behavior can be changed by using the "extend" argument.<br>
When an item with "extend" is contained in an item that uses<br>
"keepend", the "keepend" is ignored and the containing region will be<br>
extended.<br>
This can be used to have some contained items extend a region while<br>
others don't. Example:<br>
<br>
<div class="helpExample"> :syn region htmlRef start=+<a>+ end=+</a>+ keepend contains=htmlItem,htmlScript<br>
:syn match htmlItem +<[^>]*>+ contained<br>
:syn region htmlScript start=+<script+ end=+</script[^>]*>+ contained extend</div>
<br>
Here the htmlItem item does not make the htmlRef item continue<br>
further, it is only used to highlight the <> items. The htmlScript<br>
item does extend the htmlRef item.<br>
<br>
Another example:<br>
<div class="helpExample"> :syn region xmlFold start="<a>" end="</a>" fold transparent keepend extend</div>
This defines a region with "keepend", so that its end cannot be<br>
changed by contained items, like when the "</a>" is matched to<br>
highlight it differently. But when the xmlFold region is nested (it<br>
includes itself), the "extend" applies, so that the "</a>" of a nested<br>
region only ends that region, and not the one it is contained in.<br>
<br>
<a class="Constant" href="syntax.html#:syn-excludenl" name=":syn-excludenl">:syn-excludenl</a><br>
When a pattern for a match or end pattern of a region includes a '$'<br>
to match the end-of-line, it will make a region item that it is<br>
contained in continue on the next line. For example, a match with<br>
"\\$" (backslash at the end of the line) can make a region continue<br>
that would normally stop at the end of the line. This is the default<br>
behavior. If this is not wanted, there are two ways to avoid it:<br>
1. Use "keepend" for the containing item. This will keep all<br>
contained matches from extending the match or region. It can be<br>
used when all contained items must not extend the containing item.<br>
2. Use "excludenl" in the contained item. This will keep that match<br>
from extending the containing match or region. It can be used if<br>
only some contained items must not extend the containing item.<br>
"excludenl" must be given before the pattern it applies to.<br>
<br>
<a class="Constant" href="syntax.html#:syn-matchgroup" name=":syn-matchgroup">:syn-matchgroup</a><br>
"matchgroup" can be used to highlight the start and/or end pattern<br>
differently than the body of the region. Example:<br>
<div class="helpExample"> :syntax region String matchgroup=Quote start=+"+ skip=+\\"+ end=+"+</div>
This will highlight the quotes with the "Quote" group, and the text in<br>
between with the "String" group.<br>
The "matchgroup" is used for all start and end patterns that follow,<br>
until the next "matchgroup". Use "matchgroup=NONE" to go back to not<br>
using a matchgroup.<br>
<br>
In a start or end pattern that is highlighted with "matchgroup" the<br>
contained items of the region are not used. This can be used to avoid<br>
that a contained item matches in the start or end pattern match. When<br>
using "transparent", this does not apply to a start or end pattern<br>
match that is highlighted with "matchgroup".<br>
<br>
Here is an example, which highlights three levels of parentheses in<br>
different colors:<br>
<div class="helpExample"> :sy region par1 matchgroup=par1 start=/(/ end=/)/ contains=par2<br>
:sy region par2 matchgroup=par2 start=/(/ end=/)/ contains=par3 contained<br>
:sy region par3 matchgroup=par3 start=/(/ end=/)/ contains=par1 contained<br>
:hi par1 ctermfg=red guifg=red<br>
:hi par2 ctermfg=blue guifg=blue<br>
:hi par3 ctermfg=darkgreen guifg=darkgreen</div>
<br>
<a class="Constant" href="syntax.html#E849" name="E849">E849</a><br>
The maximum number of syntax groups is 19999.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
6. :syntax arguments <a class="Constant" href="syntax.html#:syn-arguments" name=":syn-arguments">:syn-arguments</a><br>
<br>
The :syntax commands that define syntax items take a number of arguments.<br>
The common ones are explained here. The arguments may be given in any order<br>
and may be mixed with patterns.<br>
<br>
Not all commands accept all arguments. This table shows which arguments<br>
can not be used for all commands:<br>
<a class="Constant" href="syntax.html#E395" name="E395">E395</a><br>
<span class="PreProc">contains oneline fold display extend concealends</span><br>
:syntax keyword - - - - - -<br>
:syntax match yes - yes yes yes -<br>
:syntax region yes yes yes yes yes yes<br>
<br>
These arguments can be used for all three commands:<br>
conceal<br>
cchar<br>
contained<br>
containedin<br>
nextgroup<br>
transparent<br>
skipwhite<br>
skipnl<br>
skipempty<br>
<br>
conceal <a class="Constant" href="syntax.html#conceal" name="conceal">conceal</a> <a class="Constant" href="syntax.html#:syn-conceal" name=":syn-conceal">:syn-conceal</a><br>
<br>
When the "conceal" argument is given, the item is marked as concealable.<br>
Whether or not it is actually concealed depends on the value of the<br>
<a class="Type" href="options.html#'conceallevel'">'conceallevel'</a> option. The <a class="Type" href="options.html#'concealcursor'">'concealcursor'</a> option is used to decide whether<br>
concealable items in the current line are displayed unconcealed to be able to<br>
edit the line.<br>
Another way to conceal text is with <a class="Identifier" href="eval.html#matchadd()">matchadd()</a>.<br>
<br>
concealends <a class="Constant" href="syntax.html#:syn-concealends" name=":syn-concealends">:syn-concealends</a><br>
<br>
When the "concealends" argument is given, the start and end matches of<br>
the region, but not the contents of the region, are marked as concealable.<br>
Whether or not they are actually concealed depends on the setting on the<br>
<a class="Type" href="options.html#'conceallevel'">'conceallevel'</a> option. The ends of a region can only be concealed separately<br>
in this way when they have their own highlighting via "matchgroup"<br>
<br>
cchar <a class="Constant" href="syntax.html#:syn-cchar" name=":syn-cchar">:syn-cchar</a><br>
<a class="Constant" href="syntax.html#E844" name="E844">E844</a><br>
The "cchar" argument defines the character shown in place of the item<br>
when it is concealed (setting "cchar" only makes sense when the conceal<br>
argument is given.) If "cchar" is not set then the default conceal<br>
character defined in the <a class="Type" href="options.html#'listchars'">'listchars'</a> option is used. The character cannot be<br>
a control character such as Tab. Example:<br>
<div class="helpExample"> :syntax match Entity "&amp;" conceal cchar=&</div>
See <a class="Identifier" href="syntax.html#hl-Conceal">hl-Conceal</a> for highlighting.<br>
<br>
contained <a class="Constant" href="syntax.html#:syn-contained" name=":syn-contained">:syn-contained</a><br>
<br>
When the "contained" argument is given, this item will not be recognized at<br>
the top level, but only when it is mentioned in the "contains" field of<br>
another match. Example:<br>
<div class="helpExample"> :syntax keyword Todo TODO contained<br>
:syntax match Comment "//.*" contains=Todo</div>
<br>
<br>
display <a class="Constant" href="syntax.html#:syn-display" name=":syn-display">:syn-display</a><br>
<br>
If the "display" argument is given, this item will be skipped when the<br>
detected highlighting will not be displayed. This will speed up highlighting,<br>
by skipping this item when only finding the syntax state for the text that is<br>
to be displayed.<br>
<br>
Generally, you can use "display" for match and region items that meet these<br>
conditions:<br>
- The item does not continue past the end of a line. Example for C: A region<br>
for a "/*" comment can't contain "display", because it continues on the next<br>
line.<br>
- The item does not contain items that continue past the end of the line or<br>
make it continue on the next line.<br>
- The item does not change the size of any item it is contained in. Example<br>
for C: A match with "\\$" in a preprocessor match can't have "display",<br>
because it may make that preprocessor match shorter.<br>
- The item does not allow other items to match that didn't match otherwise,<br>
and that item may extend the match too far. Example for C: A match for a<br>
"//" comment can't use "display", because a "/*" inside that comment would<br>
match then and start a comment which extends past the end of the line.<br>
<br>
Examples, for the C language, where "display" can be used:<br>
- match with a number<br>
- match with a label<br>
<br>
<br>
transparent <a class="Constant" href="syntax.html#:syn-transparent" name=":syn-transparent">:syn-transparent</a><br>
<br>
If the "transparent" argument is given, this item will not be highlighted<br>
itself, but will take the highlighting of the item it is contained in. This<br>
is useful for syntax items that don't need any highlighting but are used<br>
only to skip over a part of the text.<br>
<br>
The "contains=" argument is also inherited from the item it is contained in,<br>
unless a "contains" argument is given for the transparent item itself. To<br>
avoid that unwanted items are contained, use "contains=NONE". Example, which<br>
highlights words in strings, but makes an exception for "vim":<br>
<div class="helpExample"> :syn match myString /'[^']*'/ contains=myWord,myVim<br>
:syn match myWord /\<[a-z]*\>/ contained<br>
:syn match myVim /\<vim\>/ transparent contained contains=NONE<br>
:hi link myString String<br>
:hi link myWord Comment</div>
Since the "myVim" match comes after "myWord" it is the preferred match (last<br>
match in the same position overrules an earlier one). The "transparent"<br>
argument makes the "myVim" match use the same highlighting as "myString". But<br>
it does not contain anything. If the "contains=NONE" argument would be left<br>
out, then "myVim" would use the contains argument from myString and allow<br>
"myWord" to be contained, which will be highlighted as a Constant. This<br>
happens because a contained match doesn't match inside itself in the same<br>
position, thus the "myVim" match doesn't overrule the "myWord" match here.<br>
<br>
When you look at the colored text, it is like looking at layers of contained<br>
items. The contained item is on top of the item it is contained in, thus you<br>
see the contained item. When a contained item is transparent, you can look<br>
through, thus you see the item it is contained in. In a picture:<br>
<br>
look from here<br>
<br>
| | | | | |<br>
V V V V V V<br>
<br>
xxxx yyy more contained items<br>
.................... contained item (transparent)<br>
============================= first item<br>
<br>
The 'x', 'y' and '=' represent a highlighted syntax item. The '.' represent a<br>
transparent group.<br>
<br>
What you see is:<br>
<br>
=======xxxx=======yyy========<br>
<br>
Thus you look through the transparent "....".<br>
<br>
<br>
oneline <a class="Constant" href="syntax.html#:syn-oneline" name=":syn-oneline">:syn-oneline</a><br>
<br>
The "oneline" argument indicates that the region does not cross a line<br>
boundary. It must match completely in the current line. However, when the<br>
region has a contained item that does cross a line boundary, it continues on<br>
the next line anyway. A contained item can be used to recognize a line<br>
continuation pattern. But the "end" pattern must still match in the first<br>
line, otherwise the region doesn't even start.<br>
<br>
When the start pattern includes a "\n" to match an end-of-line, the end<br>
pattern must be found in the same line as where the start pattern ends. The<br>
end pattern may also include an end-of-line. Thus the "oneline" argument<br>
means that the end of the start pattern and the start of the end pattern must<br>
be within one line. This can't be changed by a skip pattern that matches a<br>
line break.<br>
<br>
<br>
fold <a class="Constant" href="syntax.html#:syn-fold" name=":syn-fold">:syn-fold</a><br>
<br>
The "fold" argument makes the fold level increase by one for this item.<br>
Example:<br>
<div class="helpExample"> :syn region myFold start="{" end="}" transparent fold<br>
:syn sync fromstart<br>
:set foldmethod=syntax</div>
This will make each {} block form one fold.<br>
<br>
The fold will start on the line where the item starts, and end where the item<br>
ends. If the start and end are within the same line, there is no fold.<br>
The <a class="Type" href="options.html#'foldnestmax'">'foldnestmax'</a> option limits the nesting of syntax folds.<br>
<span class="Special">{not available when Vim was compiled without </span><a class="Identifier" href="various.html#+folding">+folding</a><span class="Special"> feature}</span><br>
<br>
<br>
<a class="Constant" href="syntax.html#:syn-contains" name=":syn-contains">:syn-contains</a> <a class="Constant" href="syntax.html#E405" name="E405">E405</a> <a class="Constant" href="syntax.html#E406" name="E406">E406</a> <a class="Constant" href="syntax.html#E407" name="E407">E407</a> <a class="Constant" href="syntax.html#E408" name="E408">E408</a> <a class="Constant" href="syntax.html#E409" name="E409">E409</a><br>
contains=<span class="Special">{group-name}</span>,..<br>
<br>
The "contains" argument is followed by a list of syntax group names. These<br>
groups will be allowed to begin inside the item (they may extend past the<br>
containing group's end). This allows for recursive nesting of matches and<br>
regions. If there is no "contains" argument, no groups will be contained in<br>
this item. The group names do not need to be defined before they can be used<br>
here.<br>
<br>
contains=ALL<br>
If the only item in the contains list is "ALL", then all<br>
groups will be accepted inside the item.<br>
<br>
contains=ALLBUT,<span class="Special">{group-name}</span>,..<br>
If the first item in the contains list is "ALLBUT", then all<br>
groups will be accepted inside the item, except the ones that<br>
are listed. Example:<br>
<div class="helpExample"> :syntax region Block start="{" end="}" ... contains=ALLBUT,Function</div>
<br>
contains=TOP<br>
If the first item in the contains list is "TOP", then all<br>
groups will be accepted that don't have the "contained"<br>
argument.<br>
contains=TOP,<span class="Special">{group-name}</span>,..<br>
Like "TOP", but excluding the groups that are listed.<br>
<br>
contains=CONTAINED<br>
If the first item in the contains list is "CONTAINED", then<br>
all groups will be accepted that have the "contained"<br>
argument.<br>
contains=CONTAINED,<span class="Special">{group-name}</span>,..<br>
Like "CONTAINED", but excluding the groups that are<br>
listed.<br>
<br>
<br>
The <span class="Special">{group-name}</span> in the "contains" list can be a pattern. All group names<br>
that match the pattern will be included (or excluded, if "ALLBUT" is used).<br>
The pattern cannot contain white space or a ','. Example:<br>
<div class="helpExample"> ... contains=Comment.*,Keyw[0-3]</div>
The matching will be done at moment the syntax command is executed. Groups<br>
that are defined later will not be matched. Also, if the current syntax<br>
command defines a new group, it is not matched. Be careful: When putting<br>
syntax commands in a file you can't rely on groups NOT being defined, because<br>
the file may have been sourced before, and ":syn clear" doesn't remove the<br>
group names.<br>
<br>
The contained groups will also match in the start and end patterns of a<br>
region. If this is not wanted, the "matchgroup" argument can be used<br>
<a class="Identifier" href="syntax.html#:syn-matchgroup">:syn-matchgroup</a>. The "ms=" and "me=" offsets can be used to change the<br>
region where contained items do match. <span class="Todo">Note</span> that this may also limit the<br>
area that is highlighted<br>
<br>
<br>
containedin=<span class="Special">{group-name}</span>... <a class="Constant" href="syntax.html#:syn-containedin" name=":syn-containedin">:syn-containedin</a><br>
<br>
The "containedin" argument is followed by a list of syntax group names. The<br>
item will be allowed to begin inside these groups. This works as if the<br>
containing item has a "contains=" argument that includes this item.<br>
<br>
The <span class="Special">{group-name}</span>... can be used just like for "contains", as explained above.<br>
<br>
This is useful when adding a syntax item afterwards. An item can be told to<br>
be included inside an already existing item, without changing the definition<br>
of that item. For example, to highlight a word in a C comment after loading<br>
the C syntax:<br>
<div class="helpExample"> :syn keyword myword HELP containedin=cComment contained</div>
<span class="Todo">Note</span> that "contained" is also used, to avoid that the item matches at the top<br>
level.<br>
<br>
Matches for "containedin" are added to the other places where the item can<br>
appear. A "contains" argument may also be added as usual. Don't forget that<br>
keywords never contain another item, thus adding them to "containedin" won't<br>
work.<br>
<br>
<br>
nextgroup=<span class="Special">{group-name}</span>,.. <a class="Constant" href="syntax.html#:syn-nextgroup" name=":syn-nextgroup">:syn-nextgroup</a><br>
<br>
The "nextgroup" argument is followed by a list of syntax group names,<br>
separated by commas (just like with "contains", so you can also use patterns).<br>
<br>
If the "nextgroup" argument is given, the mentioned syntax groups will be<br>
tried for a match, after the match or region ends. If none of the groups have<br>
a match, highlighting continues normally. If there is a match, this group<br>
will be used, even when it is not mentioned in the "contains" field of the<br>
current group. This is like giving the mentioned group priority over all<br>
other groups. Example:<br>
<div class="helpExample"> :syntax match ccFoobar "Foo.\{-}Bar" contains=ccFoo<br>
:syntax match ccFoo "Foo" contained nextgroup=ccFiller<br>
:syntax region ccFiller start="." matchgroup=ccBar end="Bar" contained</div>
<br>
This will highlight "Foo" and "Bar" differently, and only when there is a<br>
"Bar" after "Foo". In the text line below, "f" shows where ccFoo is used for<br>
highlighting, and "bbb" where ccBar is used.<br>
<br>
<div class="helpExample"> Foo asdfasd Bar asdf Foo asdf Bar asdf<br>
fff bbb fff bbb</div>
<br>
<span class="Todo">Note</span> the use of ".\<span class="Special">{-}</span>" to skip as little as possible until the next Bar.<br>
when ".*" would be used, the "asdf" in between "Bar" and "Foo" would be<br>
highlighted according to the "ccFoobar" group, because the ccFooBar match<br>
would include the first "Foo" and the last "Bar" in the line (see <a class="Identifier" href="pattern.html#pattern">pattern</a>).<br>
<br>
<br>
skipwhite <a class="Constant" href="syntax.html#:syn-skipwhite" name=":syn-skipwhite">:syn-skipwhite</a><br>
skipnl <a class="Constant" href="syntax.html#:syn-skipnl" name=":syn-skipnl">:syn-skipnl</a><br>
skipempty <a class="Constant" href="syntax.html#:syn-skipempty" name=":syn-skipempty">:syn-skipempty</a><br>
<br>
These arguments are only used in combination with "nextgroup". They can be<br>
used to allow the next group to match after skipping some text:<br>
skipwhite skip over space and tab characters<br>
skipnl skip over the end of a line<br>
skipempty skip over empty lines (implies a "skipnl")<br>
<br>
When "skipwhite" is present, the white space is only skipped if there is no<br>
next group that matches the white space.<br>
<br>
When "skipnl" is present, the match with nextgroup may be found in the next<br>
line. This only happens when the current item ends at the end of the current<br>
line! When "skipnl" is not present, the nextgroup will only be found after<br>
the current item in the same line.<br>
<br>
When skipping text while looking for a next group, the matches for other<br>
groups are ignored. Only when no next group matches, other items are tried<br>
for a match again. This means that matching a next group and skipping white<br>
space and <span class="Special"><EOL></span>s has a higher priority than other items.<br>
<br>
Example:<br>
<div class="helpExample"> :syn match ifstart "\<if.*" nextgroup=ifline skipwhite skipempty<br>
:syn match ifline "[^ \t].*" nextgroup=ifline skipwhite skipempty contained<br>
:syn match ifline "endif" contained</div>
<span class="Todo">Note</span> that the "[^ \t].*" match matches all non-white text. Thus it would also<br>
match "endif". Therefore the "endif" match is put last, so that it takes<br>
precedence.<br>
<span class="Todo">Note</span> that this example doesn't work for nested "if"s. You need to add<br>
"contains" arguments to make that work (omitted for simplicity of the<br>
example).<br>
<br>
<span class="Statement">IMPLICIT CONCEAL </span><a class="Constant" href="syntax.html#:syn-conceal-implicit" name=":syn-conceal-implicit">:syn-conceal-implicit</a><br>
<br>
:sy[ntax] conceal [on|off]<br>
This defines if the following ":syntax" commands will define keywords,<br>
matches or regions with the "conceal" flag set. After ":syn conceal<br>
on", all subsequent ":syn keyword", ":syn match" or ":syn region"<br>
defined will have the "conceal" flag set implicitly. ":syn conceal<br>
off" returns to the normal state where the "conceal" flag must be<br>
given explicitly.<br>
<br>
:sy[ntax] conceal<br>
Show either "syntax conceal on" or "syntax conceal off" (translated).<br>
<br>
<span class="PreProc">==============================================================================</span><br>
7. Syntax patterns <a class="Constant" href="syntax.html#:syn-pattern" name=":syn-pattern">:syn-pattern</a> <a class="Constant" href="syntax.html#E401" name="E401">E401</a> <a class="Constant" href="syntax.html#E402" name="E402">E402</a><br>
<br>
In the syntax commands, a pattern must be surrounded by two identical<br>
characters. This is like it works for the ":s" command. The most common to<br>
use is the double quote. But if the pattern contains a double quote, you can<br>
use another character that is not used in the pattern. Examples:<br>
<div class="helpExample"> :syntax region Comment start="/\*" end="\*/"<br>
:syntax region String start=+"+ end=+"+ skip=+\\"+</div>
<br>
See <a class="Identifier" href="pattern.html#pattern">pattern</a> for the explanation of what a pattern is. Syntax patterns are<br>
always interpreted like the <a class="Type" href="options.html#'magic'">'magic'</a> option is set, no matter what the actual<br>
value of <a class="Type" href="options.html#'magic'">'magic'</a> is. And the patterns are interpreted like the 'l' flag is<br>
not included in <a class="Type" href="options.html#'cpoptions'">'cpoptions'</a>. This was done to make syntax files portable and<br>
independent of <a class="Type" href="options.html#'compatible'">'compatible'</a> and <a class="Type" href="options.html#'magic'">'magic'</a> settings.<br>
<br>
Try to avoid patterns that can match an empty string, such as "[a-z]*".<br>
This slows down the highlighting a lot, because it matches everywhere.<br>
<br>
<a class="Constant" href="syntax.html#:syn-pattern-offset" name=":syn-pattern-offset">:syn-pattern-offset</a><br>
The pattern can be followed by a character offset. This can be used to<br>
change the highlighted part, and to change the text area included in the<br>
match or region (which only matters when trying to match other items). Both<br>
are relative to the matched pattern. The character offset for a skip<br>
pattern can be used to tell where to continue looking for an end pattern.<br>
<br>
The offset takes the form of "<span class="Special">{what}</span>=<span class="Special">{offset}</span>"<br>
The <span class="Special">{what}</span> can be one of seven strings:<br>
<br>
ms Match Start offset for the start of the matched text<br>
me Match End offset for the end of the matched text<br>
hs Highlight Start offset for where the highlighting starts<br>
he Highlight End offset for where the highlighting ends<br>
rs Region Start offset for where the body of a region starts<br>
re Region End offset for where the body of a region ends<br>
lc Leading Context offset past "leading context" of pattern<br>
<br>
The <span class="Special">{offset}</span> can be:<br>
<br>
s start of the matched pattern<br>
s+<span class="Special">{nr}</span> start of the matched pattern plus <span class="Special">{nr}</span> chars to the right<br>
s-<span class="Special">{nr}</span> start of the matched pattern plus <span class="Special">{nr}</span> chars to the left<br>
e end of the matched pattern<br>
e+<span class="Special">{nr}</span> end of the matched pattern plus <span class="Special">{nr}</span> chars to the right<br>
e-<span class="Special">{nr}</span> end of the matched pattern plus <span class="Special">{nr}</span> chars to the left<br>
<span class="Special">{nr}</span> (for "lc" only): start matching <span class="Special">{nr}</span> chars right of the start<br>
<br>
Examples: "ms=s+1", "hs=e-2", "lc=3".<br>
<br>
Although all offsets are accepted after any pattern, they are not always<br>
meaningful. This table shows which offsets are actually used:<br>
<br>
<span class="PreProc">ms me hs he rs re lc</span><br>
match item yes yes yes yes - - yes<br>
region item start yes - yes - yes - yes<br>
region item skip - yes - - - - yes<br>
region item end - yes - yes - yes yes<br>
<br>
Offsets can be concatenated, with a ',' in between. Example:<br>
<div class="helpExample"> :syn match String /"[^"]*"/hs=s+1,he=e-1</div>
<br>
some "string" text<br>
^^^^^^ highlighted<br>
<br>
<span class="Todo">Notes</span>:<br>
- There must be no white space between the pattern and the character<br>
offset(s).<br>
- The highlighted area will never be outside of the matched text.<br>
- A negative offset for an end pattern may not always work, because the end<br>
pattern may be detected when the highlighting should already have stopped.<br>
- Before Vim 7.2 the offsets were counted in bytes instead of characters.<br>
This didn't work well for multi-byte characters, so it was changed with the<br>
Vim 7.2 release.<br>
- The start of a match cannot be in a line other than where the pattern<br>
matched. This doesn't work: "a\nb"ms=e. You can make the highlighting<br>
start in another line, this does work: "a\nb"hs=e.<br>
<br>
Example (match a comment but don't highlight the /* and */):<br>
<div class="helpExample"> :syntax region Comment start="/\*"hs=e+1 end="\*/"he=s-1</div>
<br>
/* this is a comment */<br>
^^^^^^^^^^^^^^^^^^^ highlighted<br>
<br>
A more complicated Example:<br>
<div class="helpExample"> :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</div>
<br>
abcfoostringbarabc<br>
mmmmmmmmmmm match<br>
sssrrreee highlight start/region/end ("Foo", "Exa" and "Bar")<br>
<br>
Leading context <a class="Constant" href="syntax.html#:syn-lc" name=":syn-lc">:syn-lc</a> <a class="Constant" href="syntax.html#:syn-leading" name=":syn-leading">:syn-leading</a> <a class="Constant" href="syntax.html#:syn-context" name=":syn-context">:syn-context</a><br>
<br>
<span class="Todo">Note</span>: This is an obsolete feature, only included for backwards compatibility<br>
with previous Vim versions. It's now recommended to use the <a class="Identifier" href="pattern.html#/\@<=">/\@<=</a> construct<br>
in the pattern.<br>
<br>
The "lc" offset specifies leading context -- a part of the pattern that must<br>
be present, but is not considered part of the match. An offset of "lc=n" will<br>
cause Vim to step back n columns before attempting the pattern match, allowing<br>
characters which have already been matched in previous patterns to also be<br>
used as leading context for this match. This can be used, for instance, to<br>
specify that an "escaping" character must not precede the match:<br>
<br>
<div class="helpExample"> :syn match ZNoBackslash "[^\\]z"ms=s+1<br>
:syn match WNoBackslash "[^\\]w"lc=1<br>
:syn match Underline "_\+"</div>
<br>
___zzzz ___wwww<br>
^^^ ^^^ matches Underline<br>
^ ^ matches ZNoBackslash<br>
^^^^ matches WNoBackslash<br>
<br>
The "ms" offset is automatically set to the same value as the "lc" offset,<br>
unless you set "ms" explicitly.<br>
<br>
<br>
Multi-line patterns <a class="Constant" href="syntax.html#:syn-multi-line" name=":syn-multi-line">:syn-multi-line</a><br>
<br>
The patterns can include "\n" to match an end-of-line. Mostly this works as<br>
expected, but there are a few exceptions.<br>
<br>
When using a start pattern with an offset, the start of the match is not<br>
allowed to start in a following line. The highlighting can start in a<br>
following line though. Using the "\zs" item also requires that the start of<br>
the match doesn't move to another line.<br>
<br>
The skip pattern can include the "\n", but the search for an end pattern will<br>
continue in the first character of the next line, also when that character is<br>
matched by the skip pattern. This is because redrawing may start in any line<br>
halfway a region and there is no check if the skip pattern started in a<br>
previous line. For example, if the skip pattern is "a\nb" and an end pattern<br>
is "b", the end pattern does match in the second line of this:<br>
<div class="helpExample"> x x a<br>
b x x</div>
Generally this means that the skip pattern should not match any characters<br>
after the "\n".<br>
<br>
<br>
External matches <a class="Constant" href="syntax.html#:syn-ext-match" name=":syn-ext-match">:syn-ext-match</a><br>
<br>
These extra regular expression items are available in region patterns:<br>
<br>
<a class="Constant" href="syntax.html#/\z(" name="/\z(">/\z(</a> <a class="Constant" href="syntax.html#/\z(\)" name="/\z(\)">/\z(\)</a> <a class="Constant" href="syntax.html#E50" name="E50">E50</a> <a class="Constant" href="syntax.html#E52" name="E52">E52</a> <a class="Constant" href="syntax.html#E879" name="E879">E879</a><br>
\z(\) Marks the sub-expression as "external", meaning that it can be<br>
accessed from another pattern match. Currently only usable in<br>
defining a syntax region start pattern.<br>
<br>
<a class="Constant" href="syntax.html#/\z1" name="/\z1">/\z1</a> <a class="Constant" href="syntax.html#/\z2" name="/\z2">/\z2</a> <a class="Constant" href="syntax.html#/\z3" name="/\z3">/\z3</a> <a class="Constant" href="syntax.html#/\z4" name="/\z4">/\z4</a> <a class="Constant" href="syntax.html#/\z5" name="/\z5">/\z5</a><br>
\z1 ... \z9 <a class="Constant" href="syntax.html#/\z6" name="/\z6">/\z6</a> <a class="Constant" href="syntax.html#/\z7" name="/\z7">/\z7</a> <a class="Constant" href="syntax.html#/\z8" name="/\z8">/\z8</a> <a class="Constant" href="syntax.html#/\z9" name="/\z9">/\z9</a> <a class="Constant" href="syntax.html#E66" name="E66">E66</a> <a class="Constant" href="syntax.html#E67" name="E67">E67</a><br>
Matches the same string that was matched by the corresponding<br>
sub-expression in a previous start pattern match.<br>
<br>
Sometimes the start and end patterns of a region need to share a common<br>
sub-expression. A common example is the "here" document in Perl and many Unix<br>
shells. This effect can be achieved with the "\z" special regular expression<br>
items, which marks a sub-expression as "external", in the sense that it can be<br>
referenced from outside the pattern in which it is defined. The here-document<br>
example, for instance, can be done like this:<br>
<div class="helpExample"> :syn region hereDoc start="<<\z(\I\i*\)" end="^\z1$"</div>
<br>
As can be seen here, the \z actually does double duty. In the start pattern,<br>
it marks the "\(\I\i*\)" sub-expression as external; in the end pattern, it<br>
changes the \z1 back-reference into an external reference referring to the<br>
first external sub-expression in the start pattern. External references can<br>
also be used in skip patterns:<br>
<div class="helpExample"> :syn region foo start="start \(\I\i*\)" skip="not end \z1" end="end \z1"</div>
<br>
<span class="Todo">Note</span> that normal and external sub-expressions are completely orthogonal and<br>
indexed separately; for instance, if the pattern "\z(..\)\(..\)" is applied<br>
to the string "aabb", then \1 will refer to "bb" and \z1 will refer to "aa".<br>
<span class="Todo">Note</span> also that external sub-expressions cannot be accessed as back-references<br>
within the same pattern like normal sub-expressions. If you want to use one<br>
sub-expression as both a normal and an external sub-expression, you can nest<br>
the two, as in "\(\z(...\)\)".<br>
<br>
<span class="Todo">Note</span> that only matches within a single line can be used. Multi-line matches<br>
cannot be referred to.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
8. Syntax clusters <a class="Constant" href="syntax.html#:syn-cluster" name=":syn-cluster">:syn-cluster</a> <a class="Constant" href="syntax.html#E400" name="E400">E400</a><br>
<br>
:sy[ntax] cluster <span class="Special">{cluster-name}</span> [contains=<span class="Special">{group-name}</span>..]<br>
[add=<span class="Special">{group-name}</span>..]<br>
[remove=<span class="Special">{group-name}</span>..]<br>
<br>
This command allows you to cluster a list of syntax groups together under a<br>
single name.<br>
<br>
contains=<span class="Special">{group-name}</span>..<br>
The cluster is set to the specified list of groups.<br>
add=<span class="Special">{group-name}</span>..<br>
The specified groups are added to the cluster.<br>
remove=<span class="Special">{group-name}</span>..<br>
The specified groups are removed from the cluster.<br>
<br>
A cluster so defined may be referred to in a contains=.., containedin=..,<br>
nextgroup=.., add=.. or remove=.. list with a "@" prefix. You can also use<br>
this notation to implicitly declare a cluster before specifying its contents.<br>
<br>
Example:<br>
<div class="helpExample"> :syntax match Thing "# [^#]\+ #" contains=@ThingMembers<br>
:syntax cluster ThingMembers contains=ThingMember1,ThingMember2</div>
<br>
As the previous example suggests, modifications to a cluster are effectively<br>
retroactive; the membership of the cluster is checked at the last minute, so<br>
to speak:<br>
<div class="helpExample"> :syntax keyword A aaa<br>
:syntax keyword B bbb<br>
:syntax cluster AandB contains=A<br>
:syntax match Stuff "( aaa bbb )" contains=@AandB<br>
:syntax cluster AandB add=B " now both keywords are matched in Stuff</div>
<br>
This also has implications for nested clusters:<br>
<div class="helpExample"> :syntax keyword A aaa<br>
:syntax keyword B bbb<br>
:syntax cluster SmallGroup contains=B<br>
:syntax cluster BigGroup contains=A,@SmallGroup<br>
:syntax match Stuff "( aaa bbb )" contains=@BigGroup<br>
:syntax cluster BigGroup remove=B " no effect, since B isn't in BigGroup<br>
:syntax cluster SmallGroup remove=B " now bbb isn't matched within Stuff</div>
<br>
<a class="Constant" href="syntax.html#E848" name="E848">E848</a><br>
The maximum number of clusters is 9767.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
9. Including syntax files <a class="Constant" href="syntax.html#:syn-include" name=":syn-include">:syn-include</a> <a class="Constant" href="syntax.html#E397" name="E397">E397</a><br>
<br>
It is often useful for one language's syntax file to include a syntax file for<br>
a related language. Depending on the exact relationship, this can be done in<br>
two different ways:<br>
<br>
- If top-level syntax items in the included syntax file are to be<br>
allowed at the top level in the including syntax, you can simply use<br>
the <a class="Identifier" href="repeat.html#:runtime">:runtime</a> command:<br>
<br>
<div class="helpExample"> " In cpp.vim:<br>
:runtime! syntax/c.vim<br>
:unlet b:current_syntax</div>
<br>
- If top-level syntax items in the included syntax file are to be<br>
contained within a region in the including syntax, you can use the<br>
":syntax include" command:<br>
<br>
:sy[ntax] include [@<span class="Special">{grouplist-name}</span>] <span class="Special">{file-name}</span><br>
<br>
All syntax items declared in the included file will have the<br>
"contained" flag added. In addition, if a group list is specified,<br>
all top-level syntax items in the included file will be added to<br>
that list.<br>
<br>
<div class="helpExample"> " In perl.vim:<br>
:syntax include @Pod <sfile>:p:h/pod.vim<br>
:syntax region perlPOD start="^=head" end="^=cut" contains=@Pod</div>
<br>
When <span class="Special">{file-name}</span> is an absolute path (starts with "/", "c:", "$VAR"<br>
or "<span class="Special"><sfile></span>") that file is sourced. When it is a relative path<br>
(e.g., "syntax/pod.vim") the file is searched for in <a class="Type" href="options.html#'runtimepath'">'runtimepath'</a>.<br>
All matching files are loaded. Using a relative path is<br>
recommended, because it allows a user to replace the included file<br>
with his own version, without replacing the file that does the ":syn<br>
include".<br>
<br>
<a class="Constant" href="syntax.html#E847" name="E847">E847</a><br>
The maximum number of includes is 999.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
10. Synchronizing <a class="Constant" href="syntax.html#:syn-sync" name=":syn-sync">:syn-sync</a> <a class="Constant" href="syntax.html#E403" name="E403">E403</a> <a class="Constant" href="syntax.html#E404" name="E404">E404</a><br>
<br>
Vim wants to be able to start redrawing in any position in the document. To<br>
make this possible it needs to know the syntax state at the position where<br>
redrawing starts.<br>
<br>
:sy[ntax] sync [ccomment <span class="Special">[group-name]</span> | minlines=<span class="Special">{N}</span> | ...]<br>
<br>
There are four ways to synchronize:<br>
1. Always parse from the start of the file.<br>
<a class="Identifier" href="syntax.html#:syn-sync-first">:syn-sync-first</a><br>
2. Based on C-style comments. Vim understands how C-comments work and can<br>
figure out if the current line starts inside or outside a comment.<br>
<a class="Identifier" href="syntax.html#:syn-sync-second">:syn-sync-second</a><br>
3. Jumping back a certain number of lines and start parsing there.<br>
<a class="Identifier" href="syntax.html#:syn-sync-third">:syn-sync-third</a><br>
4. Searching backwards in the text for a pattern to sync on.<br>
<a class="Identifier" href="syntax.html#:syn-sync-fourth">:syn-sync-fourth</a><br>
<br>
<a class="Constant" href="syntax.html#:syn-sync-maxlines" name=":syn-sync-maxlines">:syn-sync-maxlines</a> <a class="Constant" href="syntax.html#:syn-sync-minlines" name=":syn-sync-minlines">:syn-sync-minlines</a><br>
For the last three methods, the line range where the parsing can start is<br>
limited by "minlines" and "maxlines".<br>
<br>
If the "minlines=<span class="Special">{N}</span>" argument is given, the parsing always starts at least<br>
that many lines backwards. This can be used if the parsing may take a few<br>
lines before it's correct, or when it's not possible to use syncing.<br>
<br>
If the "maxlines=<span class="Special">{N}</span>" argument is given, the number of lines that are searched<br>
for a comment or syncing pattern is restricted to <span class="Special">N</span> lines backwards (after<br>
adding "minlines"). This is useful if you have few things to sync on and a<br>
slow machine. Example:<br>
<div class="helpExample"> :syntax sync maxlines=500 ccomment</div>
<br>
<a class="Constant" href="syntax.html#:syn-sync-linebreaks" name=":syn-sync-linebreaks">:syn-sync-linebreaks</a><br>
When using a pattern that matches multiple lines, a change in one line may<br>
cause a pattern to no longer match in a previous line. This means has to<br>
start above where the change was made. How many lines can be specified with<br>
the "linebreaks" argument. For example, when a pattern may include one line<br>
break use this:<br>
<div class="helpExample"> :syntax sync linebreaks=1</div>
The result is that redrawing always starts at least one line before where a<br>
change was made. The default value for "linebreaks" is zero. Usually the<br>
value for "minlines" is bigger than "linebreaks".<br>
<br>
<br>
First syncing method: <a class="Constant" href="syntax.html#:syn-sync-first" name=":syn-sync-first">:syn-sync-first</a><br>
<br>
<div class="helpExample"> :syntax sync fromstart</div>
<br>
The file will be parsed from the start. This makes syntax highlighting<br>
accurate, but can be slow for long files. Vim caches previously parsed text,<br>
so that it's only slow when parsing the text for the first time. However,<br>
when making changes some part of the text needs to be parsed again (worst<br>
case: to the end of the file).<br>
<br>
Using "fromstart" is equivalent to using "minlines" with a very large number.<br>
<br>
<br>
Second syncing method: <a class="Constant" href="syntax.html#:syn-sync-second" name=":syn-sync-second">:syn-sync-second</a> <a class="Constant" href="syntax.html#:syn-sync-ccomment" name=":syn-sync-ccomment">:syn-sync-ccomment</a><br>
<br>
For the second method, only the "ccomment" argument needs to be given.<br>
Example:<br>
<div class="helpExample"> :syntax sync ccomment</div>
<br>
When Vim finds that the line where displaying starts is inside a C-style<br>
comment, the last region syntax item with the group-name "Comment" will be<br>
used. This requires that there is a region with the group-name "Comment"!<br>
An alternate group name can be specified, for example:<br>
<div class="helpExample"> :syntax sync ccomment javaComment</div>
This means that the last item specified with "syn region javaComment" will be<br>
used for the detected C comment region. This only works properly if that<br>
region does have a start pattern "\/*" and an end pattern "*\/".<br>
<br>
The "maxlines" argument can be used to restrict the search to a number of<br>
lines. The "minlines" argument can be used to at least start a number of<br>
lines back (e.g., for when there is some construct that only takes a few<br>
lines, but it hard to sync on).<br>
<br>
<span class="Todo">Note</span>: Syncing on a C comment doesn't work properly when strings are used<br>
that cross a line and contain a "*/". Since letting strings cross a line<br>
is a bad programming habit (many compilers give a warning message), and the<br>
chance of a "*/" appearing inside a comment is very small, this restriction<br>
is hardly ever noticed.<br>
<br>
<br>
Third syncing method: <a class="Constant" href="syntax.html#:syn-sync-third" name=":syn-sync-third">:syn-sync-third</a><br>
<br>
For the third method, only the "minlines=<span class="Special">{N}</span>" argument needs to be given.<br>
Vim will subtract <span class="Special">{N}</span> from the line number and start parsing there. This<br>
means <span class="Special">{N}</span> extra lines need to be parsed, which makes this method a bit slower.<br>
Example:<br>
<div class="helpExample"> :syntax sync minlines=50</div>
<br>
"lines" is equivalent to "minlines" (used by older versions).<br>
<br>
<br>
Fourth syncing method: <a class="Constant" href="syntax.html#:syn-sync-fourth" name=":syn-sync-fourth">:syn-sync-fourth</a><br>
<br>
The idea is to synchronize on the end of a few specific regions, called a<br>
sync pattern. Only regions can cross lines, so when we find the end of some<br>
region, we might be able to know in which syntax item we are. The search<br>
starts in the line just above the one where redrawing starts. From there<br>
the search continues backwards in the file.<br>
<br>
This works just like the non-syncing syntax items. You can use contained<br>
matches, nextgroup, etc. But there are a few differences:<br>
- Keywords cannot be used.<br>
- The syntax items with the "sync" keyword form a completely separated group<br>
of syntax items. You can't mix syncing groups and non-syncing groups.<br>
- The matching works backwards in the buffer (line by line), instead of<br>
forwards.<br>
- A line continuation pattern can be given. It is used to decide which group<br>
of lines need to be searched like they were one line. This means that the<br>
search for a match with the specified items starts in the first of the<br>
consecutive that contain the continuation pattern.<br>
- When using "nextgroup" or "contains", this only works within one line (or<br>
group of continued lines).<br>
- When using a region, it must start and end in the same line (or group of<br>
continued lines). Otherwise the end is assumed to be at the end of the<br>
line (or group of continued lines).<br>
- When a match with a sync pattern is found, the rest of the line (or group of<br>
continued lines) is searched for another match. The last match is used.<br>
This is used when a line can contain both the start end the end of a region<br>
(e.g., in a C-comment like /* this */, the last "*/" is used).<br>
<br>
There are two ways how a match with a sync pattern can be used:<br>
1. Parsing for highlighting starts where redrawing starts (and where the<br>
search for the sync pattern started). The syntax group that is expected<br>
to be valid there must be specified. This works well when the regions<br>
that cross lines cannot contain other regions.<br>
2. Parsing for highlighting continues just after the match. The syntax group<br>
that is expected to be present just after the match must be specified.<br>
This can be used when the previous method doesn't work well. It's much<br>
slower, because more text needs to be parsed.<br>
Both types of sync patterns can be used at the same time.<br>
<br>
Besides the sync patterns, other matches and regions can be specified, to<br>
avoid finding unwanted matches.<br>
<br>
[The reason that the sync patterns are given separately, is that mostly the<br>
search for the sync point can be much simpler than figuring out the<br>
highlighting. The reduced number of patterns means it will go (much)<br>
faster.]<br>
<br>
<a class="Constant" href="syntax.html#syn-sync-grouphere" name="syn-sync-grouphere">syn-sync-grouphere</a> <a class="Constant" href="syntax.html#E393" name="E393">E393</a> <a class="Constant" href="syntax.html#E394" name="E394">E394</a><br>
:syntax sync match <span class="Special">{sync-group-name}</span> grouphere <span class="Special">{group-name}</span> "pattern" ..<br>
<br>
Define a match that is used for syncing. <span class="Special">{group-name}</span> is the<br>
name of a syntax group that follows just after the match. Parsing<br>
of the text for highlighting starts just after the match. A region<br>
must exist for this <span class="Special">{group-name}</span>. The first one defined will be used.<br>
"NONE" can be used for when there is no syntax group after the match.<br>
<br>
<a class="Constant" href="syntax.html#syn-sync-groupthere" name="syn-sync-groupthere">syn-sync-groupthere</a><br>
:syntax sync match <span class="Special">{sync-group-name}</span> groupthere <span class="Special">{group-name}</span> "pattern" ..<br>
<br>
Like "grouphere", but <span class="Special">{group-name}</span> is the name of a syntax group that<br>
is to be used at the start of the line where searching for the sync<br>
point started. The text between the match and the start of the sync<br>
pattern searching is assumed not to change the syntax highlighting.<br>
For example, in C you could search backwards for "/*" and "*/". If<br>
"/*" is found first, you know that you are inside a comment, so the<br>
"groupthere" is "cComment". If "*/" is found first, you know that you<br>
are not in a comment, so the "groupthere" is "NONE". (in practice<br>
it's a bit more complicated, because the "/*" and "*/" could appear<br>
inside a string. That's left as an exercise to the reader...).<br>
<br>
:syntax sync match ..<br>
:syntax sync region ..<br>
<br>
Without a "groupthere" argument. Define a region or match that is<br>
skipped while searching for a sync point.<br>
<br>
<a class="Constant" href="syntax.html#syn-sync-linecont" name="syn-sync-linecont">syn-sync-linecont</a><br>
:syntax sync linecont <span class="Special">{pattern}</span><br>
<br>
When <span class="Special">{pattern}</span> matches in a line, it is considered to continue in<br>
the next line. This means that the search for a sync point will<br>
consider the lines to be concatenated.<br>
<br>
If the "maxlines=<span class="Special">{N}</span>" argument is given too, the number of lines that are<br>
searched for a match is restricted to <span class="Special">N</span>. This is useful if you have very<br>
few things to sync on and a slow machine. Example:<br>
<div class="helpExample"> :syntax sync maxlines=100</div>
<br>
You can clear all sync settings with:<br>
<div class="helpExample"> :syntax sync clear</div>
<br>
You can clear specific sync patterns with:<br>
<div class="helpExample"> :syntax sync clear {sync-group-name} ..</div>
<br>
<span class="PreProc">==============================================================================</span><br>
11. Listing syntax items <a class="Constant" href="syntax.html#:syntax" name=":syntax">:syntax</a> <a class="Constant" href="syntax.html#:sy" name=":sy">:sy</a> <a class="Constant" href="syntax.html#:syn" name=":syn">:syn</a> <a class="Constant" href="syntax.html#:syn-list" name=":syn-list">:syn-list</a><br>
<br>
This command lists all the syntax items:<br>
<br>
<div class="helpExample"> :sy[ntax] [list]</div>
<br>
To show the syntax items for one syntax group:<br>
<br>
<div class="helpExample"> :sy[ntax] list {group-name}</div>
<br>
To list the syntax groups in one cluster: <a class="Constant" href="syntax.html#E392" name="E392">E392</a> <br>
<br>
<div class="helpExample"> :sy[ntax] list @{cluster-name}</div>
<br>
See above for other arguments for the ":syntax" command.<br>
<br>
<span class="Todo">Note</span> that the ":syntax" command can be abbreviated to ":sy", although ":syn"<br>
is mostly used, because it looks better.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
12. Highlight command <a class="Constant" href="syntax.html#:highlight" name=":highlight">:highlight</a> <a class="Constant" href="syntax.html#:hi" name=":hi">:hi</a> <a class="Constant" href="syntax.html#E28" name="E28">E28</a> <a class="Constant" href="syntax.html#E411" name="E411">E411</a> <a class="Constant" href="syntax.html#E415" name="E415">E415</a><br>
<br>
There are three types of highlight groups:<br>
- The ones used for specific languages. For these the name starts with the<br>
name of the language. Many of these don't have any attributes, but are<br>
linked to a group of the second type.<br>
- The ones used for all syntax languages.<br>
- The ones used for the <a class="Type" href="options.html#'highlight'">'highlight'</a> option.<br>
<a class="Constant" href="syntax.html#hitest.vim" name="hitest.vim">hitest.vim</a><br>
You can see all the groups currently active with this command:<br>
<div class="helpExample"> :so $VIMRUNTIME/syntax/hitest.vim</div>
This will open a new window containing all highlight group names, displayed<br>
in their own color.<br>
<br>
<a class="Constant" href="syntax.html#:colo" name=":colo">:colo</a> <a class="Constant" href="syntax.html#:colorscheme" name=":colorscheme">:colorscheme</a> <a class="Constant" href="syntax.html#E185" name="E185">E185</a><br>
:colo[rscheme] Output the name of the currently active color scheme.<br>
This is basically the same as<br>
<div class="helpExample"> :echo g:colors_name</div>
In case g:colors_name has not been defined :colo will<br>
output "default". When compiled without the <a class="Identifier" href="various.html#+eval">+eval</a><br>
feature it will output "unknown".<br>
<br>
:colo[rscheme] <span class="Special">{name}</span> Load color scheme <span class="Special">{name}</span>. This searches <a class="Type" href="options.html#'runtimepath'">'runtimepath'</a><br>
for the file "colors/<span class="Special">{name}</span>.vim". The first one that<br>
is found is loaded.<br>
Also searches all plugins in <a class="Type" href="options.html#'packpath'">'packpath'</a>, first below<br>
"start" and then under "opt".<br>
<br>
Doesn't work recursively, thus you can't use<br>
":colorscheme" in a color scheme script.<br>
<br>
To customize a colorscheme use another name, e.g.<br>
"~/.vim/colors/mine.vim", and use <a class="Comment" href="repeat.html#:runtime">:runtime</a> to load<br>
the original colorscheme:<br>
<div class="helpExample"> runtime colors/evening.vim<br>
hi Statement ctermfg=Blue guifg=Blue</div>
<br>
After the color scheme has been loaded the<br>
<a class="Identifier" href="autocmd.html#ColorScheme">ColorScheme</a> autocommand event is triggered.<br>
For info about writing a colorscheme file:<br>
<div class="helpExample"> :edit $VIMRUNTIME/colors/README.txt</div>
<br>
:hi[ghlight] List all the current highlight groups that have<br>
attributes set.<br>
<br>
:hi[ghlight] <span class="Special">{group-name}</span><br>
List one highlight group.<br>
<br>
:hi[ghlight] clear Reset all highlighting to the defaults. Removes all<br>
highlighting for groups added by the user!<br>
Uses the current value of <a class="Type" href="options.html#'background'">'background'</a> to decide which<br>
default colors to use.<br>
<br>
:hi[ghlight] clear <span class="Special">{group-name}</span><br>
:hi[ghlight] <span class="Special">{group-name}</span> NONE<br>
Disable the highlighting for one highlight group. It<br>
is _not_ set back to the default colors.<br>
<br>
:hi[ghlight] <span class="Special">[default]</span> <span class="Special">{group-name}</span> <span class="Special">{key}</span>=<span class="Special">{arg}</span> ..<br>
Add a highlight group, or change the highlighting for<br>
an existing group.<br>
See <a class="Identifier" href="syntax.html#highlight-args">highlight-args</a> for the <span class="Special">{key}</span>=<span class="Special">{arg}</span> arguments.<br>
See <a class="Identifier" href="syntax.html#:highlight-default">:highlight-default</a> for the optional <span class="Special">[default]</span><br>
argument.<br>
<br>
Normally a highlight group is added once when starting up. This sets the<br>
default values for the highlighting. After that, you can use additional<br>
highlight commands to change the arguments that you want to set to non-default<br>
values. The value "NONE" can be used to switch the value off or go back to<br>
the default value.<br>
<br>
A simple way to change colors is with the <a class="Identifier" href="syntax.html#:colorscheme">:colorscheme</a> command. This loads<br>
a file with ":highlight" commands such as this:<br>
<br>
<div class="helpExample"> :hi Comment gui=bold</div>
<br>
<span class="Todo">Note</span> that all settings that are not included remain the same, only the<br>
specified field is used, and settings are merged with previous ones. So, the<br>
result is like this single command has been used:<br>
<div class="helpExample"> :hi Comment term=bold ctermfg=Cyan guifg=#80a0ff gui=bold</div>
<br>
<a class="Constant" href="syntax.html#:highlight-verbose" name=":highlight-verbose">:highlight-verbose</a><br>
When listing a highlight group and <a class="Type" href="options.html#'verbose'">'verbose'</a> is non-zero, the listing will<br>
also tell where it was last set. Example:<br>
<div class="helpExample"> :verbose hi Comment</div>
<span class="PreProc">Comment xxx term=bold ctermfg=4 guifg=Blue</span><br>
<span class="PreProc">Last set from /home/mool/vim/vim7/runtime/syntax/syncolor.vim</span><br>
<br>
When ":hi clear" is used then the script where this command is used will be<br>
mentioned for the default values. See <a class="Identifier" href="various.html#:verbose-cmd">:verbose-cmd</a> for more information.<br>
<br>
<a class="Constant" href="syntax.html#highlight-args" name="highlight-args">highlight-args</a> <a class="Constant" href="syntax.html#E416" name="E416">E416</a> <a class="Constant" href="syntax.html#E417" name="E417">E417</a> <a class="Constant" href="syntax.html#E423" name="E423">E423</a><br>
There are three types of terminals for highlighting:<br>
term a normal terminal (vt100, xterm)<br>
cterm a color terminal (MS-DOS console, color-xterm, these have the "Co"<br>
termcap entry)<br>
gui the GUI<br>
<br>
For each type the highlighting can be given. This makes it possible to use<br>
the same syntax file on all terminals, and use the optimal highlighting.<br>
<br>
1. highlight arguments for normal terminals<br>
<br>
<a class="Constant" href="syntax.html#bold" name="bold">bold</a> <a class="Constant" href="syntax.html#underline" name="underline">underline</a> <a class="Constant" href="syntax.html#undercurl" name="undercurl">undercurl</a><br>
<a class="Constant" href="syntax.html#inverse" name="inverse">inverse</a> <a class="Constant" href="syntax.html#italic" name="italic">italic</a> <a class="Constant" href="syntax.html#standout" name="standout">standout</a><br>
term=<span class="Special">{attr-list}</span> <a class="Constant" href="syntax.html#attr-list" name="attr-list">attr-list</a> <a class="Constant" href="syntax.html#highlight-term" name="highlight-term">highlight-term</a> <a class="Constant" href="syntax.html#E418" name="E418">E418</a><br>
attr-list is a comma separated list (without spaces) of the<br>
following items (in any order):<br>
bold<br>
underline<br>
undercurl not always available<br>
reverse<br>
inverse same as reverse<br>
italic<br>
standout<br>
NONE no attributes used (used to reset it)<br>
<br>
<span class="Todo">Note</span> that "bold" can be used here and by using a bold font. They<br>
have the same effect.<br>
"undercurl" is a curly underline. When "undercurl" is not possible<br>
then "underline" is used. In general "undercurl" is only available in<br>
the GUI. The color is set with <a class="Identifier" href="syntax.html#highlight-guisp">highlight-guisp</a>.<br>
<br>
start=<span class="Special">{term-list}</span> <a class="Constant" href="syntax.html#highlight-start" name="highlight-start">highlight-start</a> <a class="Constant" href="syntax.html#E422" name="E422">E422</a><br>
stop=<span class="Special">{term-list}</span> <a class="Constant" href="syntax.html#term-list" name="term-list">term-list</a> <a class="Constant" href="syntax.html#highlight-stop" name="highlight-stop">highlight-stop</a><br>
These lists of terminal codes can be used to get<br>
non-standard attributes on a terminal.<br>
<br>
The escape sequence specified with the "start" argument<br>
is written before the characters in the highlighted<br>
area. It can be anything that you want to send to the<br>
terminal to highlight this area. The escape sequence<br>
specified with the "stop" argument is written after the<br>
highlighted area. This should undo the "start" argument.<br>
Otherwise the screen will look messed up.<br>
<br>
The <span class="Special">{term-list}</span> can have two forms:<br>
<br>
1. A string with escape sequences.<br>
This is any string of characters, except that it can't start with<br>
"t_" and blanks are not allowed. The <> notation is recognized<br>
here, so you can use things like "<span class="Special"><Esc></span>" and "<span class="Special"><Space></span>". Example:<br>
start=<span class="Special"><Esc></span>[27h;<span class="Special"><Esc></span>[<span class="Special"><Space></span>r;<br>
<br>
2. A list of terminal codes.<br>
Each terminal code has the form "t_xx", where "xx" is the name of<br>
the termcap entry. The codes have to be separated with commas.<br>
White space is not allowed. Example:<br>
start=t_C1,t_BL<br>
The terminal codes must exist for this to work.<br>
<br>
<br>
2. highlight arguments for color terminals<br>
<br>
cterm=<span class="Special">{attr-list}</span> <a class="Constant" href="syntax.html#highlight-cterm" name="highlight-cterm">highlight-cterm</a><br>
See above for the description of <span class="Special">{attr-list}</span> <a class="Identifier" href="syntax.html#attr-list">attr-list</a>.<br>
The "cterm" argument is likely to be different from "term", when<br>
colors are used. For example, in a normal terminal comments could<br>
be underlined, in a color terminal they can be made Blue.<br>
<span class="Todo">Note</span>: Many terminals (e.g., DOS console) can't mix these attributes<br>
with coloring. Use only one of "cterm=" OR "ctermfg=" OR "ctermbg=".<br>
<br>
ctermfg=<span class="Special">{color-nr}</span> <a class="Constant" href="syntax.html#highlight-ctermfg" name="highlight-ctermfg">highlight-ctermfg</a> <a class="Constant" href="syntax.html#E421" name="E421">E421</a><br>
ctermbg=<span class="Special">{color-nr}</span> <a class="Constant" href="syntax.html#highlight-ctermbg" name="highlight-ctermbg">highlight-ctermbg</a><br>
The <span class="Special">{color-nr}</span> argument is a color number. Its range is zero to<br>
(not including) the number given by the termcap entry "Co".<br>
The actual color with this number depends on the type of terminal<br>
and its settings. Sometimes the color also depends on the settings of<br>
"cterm". For example, on some systems "cterm=bold ctermfg=3" gives<br>
another color, on others you just get color 3.<br>
<br>
For an xterm this depends on your resources, and is a bit<br>
unpredictable. See your xterm documentation for the defaults. The<br>
colors for a color-xterm can be changed from the .Xdefaults file.<br>
Unfortunately this means that it's not possible to get the same colors<br>
for each user. See <a class="Identifier" href="syntax.html#xterm-color">xterm-color</a> for info about color xterms.<br>
<br>
The MSDOS standard colors are fixed (in a console window), so these<br>
have been used for the names. But the meaning of color names in X11<br>
are fixed, so these color settings have been used, to make the<br>
highlighting settings portable (complicated, isn't it?). The<br>
following names are recognized, with the color number used:<br>
<br>
<a class="Constant" href="syntax.html#cterm-colors" name="cterm-colors">cterm-colors</a><br>
<span class="PreProc">NR-16 NR-8 COLOR NAME</span><br>
0 0 Black<br>
1 4 DarkBlue<br>
2 2 DarkGreen<br>
3 6 DarkCyan<br>
4 1 DarkRed<br>
5 5 DarkMagenta<br>
6 3 Brown, DarkYellow<br>
7 7 LightGray, LightGrey, Gray, Grey<br>
8 0* DarkGray, DarkGrey<br>
9 4* Blue, LightBlue<br>
10 2* Green, LightGreen<br>
11 6* Cyan, LightCyan<br>
12 1* Red, LightRed<br>
13 5* Magenta, LightMagenta<br>
14 3* Yellow, LightYellow<br>
15 7* White<br>
<br>
The number under "NR-16" is used for 16-color terminals (<a class="Type" href="term.html#'t_Co'">'t_Co'</a><br>
greater than or equal to 16). The number under "NR-8" is used for<br>
8-color terminals (<a class="Type" href="term.html#'t_Co'">'t_Co'</a> less than 16). The '*' indicates that the<br>
bold attribute is set for ctermfg. In many 8-color terminals (e.g.,<br>
"linux"), this causes the bright colors to appear. This doesn't work<br>
for background colors! Without the '*' the bold attribute is removed.<br>
If you want to set the bold attribute in a different way, put a<br>
"cterm=" argument AFTER the "ctermfg=" or "ctermbg=" argument. Or use<br>
a number instead of a color name.<br>
<br>
The case of the color names is ignored.<br>
<span class="Todo">Note</span> that for 16 color ansi style terminals (including xterms), the<br>
numbers in the NR-8 column is used. Here '*' means 'add 8' so that Blue<br>
is 12, DarkGray is 8 etc.<br>
<br>
<span class="Todo">Note</span> that for some color terminals these names may result in the wrong<br>
colors!<br>
<br>
You can also use "NONE" to remove the color.<br>
<br>
<a class="Constant" href="syntax.html#:hi-normal-cterm" name=":hi-normal-cterm">:hi-normal-cterm</a><br>
When setting the "ctermfg" or "ctermbg" colors for the Normal group,<br>
these will become the colors used for the non-highlighted text.<br>
Example:<br>
<div class="helpExample"> :highlight Normal ctermfg=grey ctermbg=darkblue</div>
When setting the "ctermbg" color for the Normal group, the<br>
<a class="Type" href="options.html#'background'">'background'</a> option will be adjusted automatically, under the<br>
condition that the color is recognized and <a class="Type" href="options.html#'background'">'background'</a> was not set<br>
explicitly. This causes the highlight groups that depend on<br>
<a class="Type" href="options.html#'background'">'background'</a> to change! This means you should set the colors for<br>
Normal first, before setting other colors.<br>
When a colorscheme is being used, changing <a class="Type" href="options.html#'background'">'background'</a> causes it to<br>
be reloaded, which may reset all colors (including Normal). First<br>
delete the "g:colors_name" variable when you don't want this.<br>
<br>
When you have set "ctermfg" or "ctermbg" for the Normal group, Vim<br>
needs to reset the color when exiting. This is done with the "op"<br>
termcap entry <a class="Identifier" href="term.html#t_op">t_op</a>. If this doesn't work correctly, try setting the<br>
<a class="Type" href="term.html#'t_op'">'t_op'</a> option in your .vimrc.<br>
<a class="Constant" href="syntax.html#E419" name="E419">E419</a> <a class="Constant" href="syntax.html#E420" name="E420">E420</a><br>
When Vim knows the normal foreground and background colors, "fg" and<br>
"bg" can be used as color names. This only works after setting the<br>
colors for the Normal group and for the MS-DOS console. Example, for<br>
reverse video:<br>
<div class="helpExample"> :highlight Visual ctermfg=bg ctermbg=fg</div>
<span class="Todo">Note</span> that the colors are used that are valid at the moment this<br>
command are given. If the Normal group colors are changed later, the<br>
"fg" and "bg" colors will not be adjusted.<br>
<br>
<br>
3. highlight arguments for the GUI<br>
<br>
gui=<span class="Special">{attr-list}</span> <a class="Constant" href="syntax.html#highlight-gui" name="highlight-gui">highlight-gui</a><br>
These give the attributes to use in the GUI mode.<br>
See <a class="Identifier" href="syntax.html#attr-list">attr-list</a> for a description.<br>
<span class="Todo">Note</span> that "bold" can be used here and by using a bold font. They<br>
have the same effect.<br>
<span class="Todo">Note</span> that the attributes are ignored for the "Normal" group.<br>
<br>
font=<span class="Special">{font-name}</span> <a class="Constant" href="syntax.html#highlight-font" name="highlight-font">highlight-font</a><br>
font-name is the name of a font, as it is used on the system Vim<br>
runs on. For X11 this is a complicated name, for example:<br>
<div class="helpExample"> font=-misc-fixed-bold-r-normal--14-130-75-75-c-70-iso8859-1</div>
<br>
The font-name "NONE" can be used to revert to the default font.<br>
When setting the font for the "Normal" group, this becomes the default<br>
font (until the <a class="Type" href="options.html#'guifont'">'guifont'</a> option is changed; the last one set is<br>
used).<br>
The following only works with Motif and Athena, not with other GUIs:<br>
When setting the font for the "Menu" group, the menus will be changed.<br>
When setting the font for the "Tooltip" group, the tooltips will be<br>
changed.<br>
All fonts used, except for Menu and Tooltip, should be of the same<br>
character size as the default font! Otherwise redrawing problems will<br>
occur.<br>
To use a font name with an embedded space or other special character,<br>
put it in single quotes. The single quote cannot be used then.<br>
Example:<br>
<div class="helpExample"> :hi comment font='Monospace 10'</div>
<br>
guifg=<span class="Special">{color-name}</span> <a class="Constant" href="syntax.html#highlight-guifg" name="highlight-guifg">highlight-guifg</a><br>
guibg=<span class="Special">{color-name}</span> <a class="Constant" href="syntax.html#highlight-guibg" name="highlight-guibg">highlight-guibg</a><br>
guisp=<span class="Special">{color-name}</span> <a class="Constant" href="syntax.html#highlight-guisp" name="highlight-guisp">highlight-guisp</a><br>
These give the foreground (guifg), background (guibg) and special<br>
(guisp) color to use in the GUI. "guisp" is used for undercurl.<br>
There are a few special names:<br>
NONE no color (transparent)<br>
bg use normal background color<br>
background use normal background color<br>
fg use normal foreground color<br>
foreground use normal foreground color<br>
To use a color name with an embedded space or other special character,<br>
put it in single quotes. The single quote cannot be used then.<br>
Example:<br>
<div class="helpExample"> :hi comment guifg='salmon pink'</div>
<br>
<a class="Constant" href="syntax.html#gui-colors" name="gui-colors">gui-colors</a><br>
Suggested color names (these are available on most systems):<br>
Red LightRed DarkRed<br>
Green LightGreen DarkGreen SeaGreen<br>
Blue LightBlue DarkBlue SlateBlue<br>
Cyan LightCyan DarkCyan<br>
Magenta LightMagenta DarkMagenta<br>
Yellow LightYellow Brown DarkYellow<br>
Gray LightGray DarkGray<br>
Black White<br>
Orange Purple Violet<br>
<br>
In the Win32 GUI version, additional system colors are available. See<br>
<a class="Identifier" href="gui_w32.html#win32-colors">win32-colors</a>.<br>
<br>
You can also specify a color by its Red, Green and Blue values.<br>
The format is "#rrggbb", where<br>
"rr" is the Red value<br>
"gg" is the Green value<br>
"bb" is the Blue value<br>
All values are hexadecimal, range from "00" to "ff". Examples:<br>
<div class="helpExample"> :highlight Comment guifg=#11f0c3 guibg=#ff00ff</div>
<br>
<a class="Constant" href="syntax.html#highlight-groups" name="highlight-groups">highlight-groups</a> <a class="Constant" href="syntax.html#highlight-default" name="highlight-default">highlight-default</a><br>
These are the default highlighting groups. These groups are used by the<br>
<a class="Type" href="options.html#'highlight'">'highlight'</a> option default. <span class="Todo">Note</span> that the highlighting depends on the value<br>
of <a class="Type" href="options.html#'background'">'background'</a>. You can see the current settings with the ":highlight"<br>
command.<br>
<a class="Constant" href="syntax.html#hl-ColorColumn" name="hl-ColorColumn">hl-ColorColumn</a><br>
ColorColumn used for the columns set with <a class="Type" href="options.html#'colorcolumn'">'colorcolumn'</a><br>
<a class="Constant" href="syntax.html#hl-Conceal" name="hl-Conceal">hl-Conceal</a><br>
Conceal placeholder characters substituted for concealed<br>
text (see <a class="Type" href="options.html#'conceallevel'">'conceallevel'</a>)<br>
<a class="Constant" href="syntax.html#hl-Cursor" name="hl-Cursor">hl-Cursor</a><br>
Cursor the character under the cursor<br>
<a class="Constant" href="syntax.html#hl-CursorIM" name="hl-CursorIM">hl-CursorIM</a><br>
CursorIM like Cursor, but used when in IME mode <a class="Identifier" href="mbyte.html#CursorIM">CursorIM</a><br>
<a class="Constant" href="syntax.html#hl-CursorColumn" name="hl-CursorColumn">hl-CursorColumn</a><br>
CursorColumn the screen column that the cursor is in when <a class="Type" href="options.html#'cursorcolumn'">'cursorcolumn'</a> is<br>
set<br>
<a class="Constant" href="syntax.html#hl-CursorLine" name="hl-CursorLine">hl-CursorLine</a><br>
CursorLine the screen line that the cursor is in when <a class="Type" href="options.html#'cursorline'">'cursorline'</a> is<br>
set<br>
<a class="Constant" href="syntax.html#hl-Directory" name="hl-Directory">hl-Directory</a><br>
Directory directory names (and other special names in listings)<br>
<a class="Constant" href="syntax.html#hl-DiffAdd" name="hl-DiffAdd">hl-DiffAdd</a><br>
DiffAdd diff mode: Added line <a class="Identifier" href="diff.html">diff.txt</a><br>
<a class="Constant" href="syntax.html#hl-DiffChange" name="hl-DiffChange">hl-DiffChange</a><br>
DiffChange diff mode: Changed line <a class="Identifier" href="diff.html">diff.txt</a><br>
<a class="Constant" href="syntax.html#hl-DiffDelete" name="hl-DiffDelete">hl-DiffDelete</a><br>
DiffDelete diff mode: Deleted line <a class="Identifier" href="diff.html">diff.txt</a><br>
<a class="Constant" href="syntax.html#hl-DiffText" name="hl-DiffText">hl-DiffText</a><br>
DiffText diff mode: Changed text within a changed line <a class="Identifier" href="diff.html">diff.txt</a><br>
<a class="Constant" href="syntax.html#hl-EndOfBuffer" name="hl-EndOfBuffer">hl-EndOfBuffer</a><br>
EndOfBuffer filler lines (~) after the last line in the buffer.<br>
By default, this is highlighted like <a class="Identifier" href="syntax.html#hl-NonText">hl-NonText</a>.<br>
<a class="Constant" href="syntax.html#hl-ErrorMsg" name="hl-ErrorMsg">hl-ErrorMsg</a><br>
ErrorMsg error messages on the command line<br>
<a class="Constant" href="syntax.html#hl-VertSplit" name="hl-VertSplit">hl-VertSplit</a><br>
VertSplit the column separating vertically split windows<br>
<a class="Constant" href="syntax.html#hl-Folded" name="hl-Folded">hl-Folded</a><br>
Folded line used for closed folds<br>
<a class="Constant" href="syntax.html#hl-FoldColumn" name="hl-FoldColumn">hl-FoldColumn</a><br>
FoldColumn <a class="Type" href="options.html#'foldcolumn'">'foldcolumn'</a><br>
<a class="Constant" href="syntax.html#hl-SignColumn" name="hl-SignColumn">hl-SignColumn</a><br>
SignColumn column where <a class="Identifier" href="sign.html#signs">signs</a> are displayed<br>
<a class="Constant" href="syntax.html#hl-IncSearch" name="hl-IncSearch">hl-IncSearch</a><br>
IncSearch <a class="Type" href="options.html#'incsearch'">'incsearch'</a> highlighting; also used for the text replaced with<br>
":s///c"<br>
<a class="Constant" href="syntax.html#hl-LineNr" name="hl-LineNr">hl-LineNr</a><br>
LineNr Line number for ":number" and ":#" commands, and when <a class="Type" href="options.html#'number'">'number'</a><br>
or <a class="Type" href="options.html#'relativenumber'">'relativenumber'</a> option is set.<br>
<a class="Constant" href="syntax.html#hl-CursorLineNr" name="hl-CursorLineNr">hl-CursorLineNr</a><br>
CursorLineNr Like LineNr when <a class="Type" href="options.html#'cursorline'">'cursorline'</a> or <a class="Type" href="options.html#'relativenumber'">'relativenumber'</a> is set for<br>
the cursor line.<br>
<a class="Constant" href="syntax.html#hl-MatchParen" name="hl-MatchParen">hl-MatchParen</a><br>
MatchParen The character under the cursor or just before it, if it<br>
is a paired bracket, and its match. <a class="Identifier" href="pi_paren.html">pi_paren.txt</a><br>
<br>
<a class="Constant" href="syntax.html#hl-ModeMsg" name="hl-ModeMsg">hl-ModeMsg</a><br>
ModeMsg <a class="Type" href="options.html#'showmode'">'showmode'</a> message (e.g., "-- INSERT --")<br>
<a class="Constant" href="syntax.html#hl-MoreMsg" name="hl-MoreMsg">hl-MoreMsg</a><br>
MoreMsg <a class="Identifier" href="message.html#more-prompt">more-prompt</a><br>
<a class="Constant" href="syntax.html#hl-NonText" name="hl-NonText">hl-NonText</a><br>
NonText '@' at the end of the window, characters from <a class="Type" href="options.html#'showbreak'">'showbreak'</a><br>
and other characters that do not really exist in the text<br>
(e.g., ">" displayed when a double-wide character doesn't<br>
fit at the end of the line).<br>
<a class="Constant" href="syntax.html#hl-Normal" name="hl-Normal">hl-Normal</a><br>
Normal normal text<br>
<a class="Constant" href="syntax.html#hl-Pmenu" name="hl-Pmenu">hl-Pmenu</a><br>
Pmenu Popup menu: normal item.<br>
<a class="Constant" href="syntax.html#hl-PmenuSel" name="hl-PmenuSel">hl-PmenuSel</a><br>
PmenuSel Popup menu: selected item.<br>
<a class="Constant" href="syntax.html#hl-PmenuSbar" name="hl-PmenuSbar">hl-PmenuSbar</a><br>
PmenuSbar Popup menu: scrollbar.<br>
<a class="Constant" href="syntax.html#hl-PmenuThumb" name="hl-PmenuThumb">hl-PmenuThumb</a><br>
PmenuThumb Popup menu: Thumb of the scrollbar.<br>
<a class="Constant" href="syntax.html#hl-Question" name="hl-Question">hl-Question</a><br>
Question <a class="Identifier" href="message.html#hit-enter">hit-enter</a> prompt and yes/no questions<br>
<a class="Constant" href="syntax.html#hl-QuickFixLine" name="hl-QuickFixLine">hl-QuickFixLine</a><br>
QuickFixLine Current <a class="Identifier" href="quickfix.html#quickfix">quickfix</a> item in the quickfix window.<br>
<a class="Constant" href="syntax.html#hl-Search" name="hl-Search">hl-Search</a><br>
Search Last search pattern highlighting (see <a class="Type" href="options.html#'hlsearch'">'hlsearch'</a>).<br>
Also used for similar items that need to stand out.<br>
<a class="Constant" href="syntax.html#hl-SpecialKey" name="hl-SpecialKey">hl-SpecialKey</a><br>
SpecialKey Meta and special keys listed with ":map", also for text used<br>
to show unprintable characters in the text, <a class="Type" href="options.html#'listchars'">'listchars'</a>.<br>
Generally: text that is displayed differently from what it<br>
really is.<br>
<a class="Constant" href="syntax.html#hl-SpellBad" name="hl-SpellBad">hl-SpellBad</a><br>
SpellBad Word that is not recognized by the spellchecker. <a class="Identifier" href="spell.html#spell">spell</a><br>
This will be combined with the highlighting used otherwise.<br>
<a class="Constant" href="syntax.html#hl-SpellCap" name="hl-SpellCap">hl-SpellCap</a><br>
SpellCap Word that should start with a capital. <a class="Identifier" href="spell.html#spell">spell</a><br>
This will be combined with the highlighting used otherwise.<br>
<a class="Constant" href="syntax.html#hl-SpellLocal" name="hl-SpellLocal">hl-SpellLocal</a><br>
SpellLocal Word that is recognized by the spellchecker as one that is<br>
used in another region. <a class="Identifier" href="spell.html#spell">spell</a><br>
This will be combined with the highlighting used otherwise.<br>
<a class="Constant" href="syntax.html#hl-SpellRare" name="hl-SpellRare">hl-SpellRare</a><br>
SpellRare Word that is recognized by the spellchecker as one that is<br>
hardly ever used. <a class="Identifier" href="spell.html#spell">spell</a><br>
This will be combined with the highlighting used otherwise.<br>
<a class="Constant" href="syntax.html#hl-StatusLine" name="hl-StatusLine">hl-StatusLine</a><br>
StatusLine status line of current window<br>
<a class="Constant" href="syntax.html#hl-StatusLineNC" name="hl-StatusLineNC">hl-StatusLineNC</a><br>
StatusLineNC status lines of not-current windows<br>
<span class="Todo">Note</span>: if this is equal to "StatusLine" Vim will use "^^^" in<br>
the status line of the current window.<br>
<a class="Constant" href="syntax.html#hl-TabLine" name="hl-TabLine">hl-TabLine</a><br>
TabLine tab pages line, not active tab page label<br>
<a class="Constant" href="syntax.html#hl-TabLineFill" name="hl-TabLineFill">hl-TabLineFill</a><br>
TabLineFill tab pages line, where there are no labels<br>
<a class="Constant" href="syntax.html#hl-TabLineSel" name="hl-TabLineSel">hl-TabLineSel</a><br>
TabLineSel tab pages line, active tab page label<br>
<a class="Constant" href="syntax.html#hl-Title" name="hl-Title">hl-Title</a><br>
Title titles for output from ":set all", ":autocmd" etc.<br>
<a class="Constant" href="syntax.html#hl-Visual" name="hl-Visual">hl-Visual</a><br>
Visual Visual mode selection<br>
<a class="Constant" href="syntax.html#hl-VisualNOS" name="hl-VisualNOS">hl-VisualNOS</a><br>
VisualNOS Visual mode selection when vim is "Not Owning the Selection".<br>
Only X11 Gui's <a class="Identifier" href="gui_x11.html#gui-x11">gui-x11</a> and <a class="Identifier" href="term.html#xterm-clipboard">xterm-clipboard</a> supports this.<br>
<a class="Constant" href="syntax.html#hl-WarningMsg" name="hl-WarningMsg">hl-WarningMsg</a><br>
WarningMsg warning messages<br>
<a class="Constant" href="syntax.html#hl-WildMenu" name="hl-WildMenu">hl-WildMenu</a><br>
WildMenu current match in <a class="Type" href="options.html#'wildmenu'">'wildmenu'</a> completion<br>
<br>
<a class="Constant" href="syntax.html#hl-User1" name="hl-User1">hl-User1</a> <a class="Constant" href="syntax.html#hl-User1..9" name="hl-User1..9">hl-User1..9</a> <a class="Constant" href="syntax.html#hl-User9" name="hl-User9">hl-User9</a><br>
The <a class="Type" href="options.html#'statusline'">'statusline'</a> syntax allows the use of 9 different highlights in the<br>
statusline and ruler (via <a class="Type" href="options.html#'rulerformat'">'rulerformat'</a>). The names are User1 to User9.<br>
<br>
For the GUI you can use the following groups to set the colors for the menu,<br>
scrollbars and tooltips. They don't have defaults. This doesn't work for the<br>
Win32 GUI. Only three highlight arguments have any effect here: font, guibg,<br>
and guifg.<br>
<br>
<a class="Constant" href="syntax.html#hl-Menu" name="hl-Menu">hl-Menu</a><br>
Menu Current font, background and foreground colors of the menus.<br>
Also used for the toolbar.<br>
Applicable highlight arguments: font, guibg, guifg.<br>
<br>
<span class="Todo">NOTE</span>: For Motif and Athena the font argument actually<br>
specifies a fontset at all times, no matter if <a class="Type" href="options.html#'guifontset'">'guifontset'</a> is<br>
empty, and as such it is tied to the current <a class="Identifier" href="mlang.html#:language">:language</a> when<br>
set.<br>
<br>
<a class="Constant" href="syntax.html#hl-Scrollbar" name="hl-Scrollbar">hl-Scrollbar</a><br>
Scrollbar Current background and foreground of the main window's<br>
scrollbars.<br>
Applicable highlight arguments: guibg, guifg.<br>
<br>
<a class="Constant" href="syntax.html#hl-Tooltip" name="hl-Tooltip">hl-Tooltip</a><br>
Tooltip Current font, background and foreground of the tooltips.<br>
Applicable highlight arguments: font, guibg, guifg.<br>
<br>
<span class="Todo">NOTE</span>: For Motif and Athena the font argument actually<br>
specifies a fontset at all times, no matter if <a class="Type" href="options.html#'guifontset'">'guifontset'</a> is<br>
empty, and as such it is tied to the current <a class="Identifier" href="mlang.html#:language">:language</a> when<br>
set.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
13. Linking groups <a class="Constant" href="syntax.html#:hi-link" name=":hi-link">:hi-link</a> <a class="Constant" href="syntax.html#:highlight-link" name=":highlight-link">:highlight-link</a> <a class="Constant" href="syntax.html#E412" name="E412">E412</a> <a class="Constant" href="syntax.html#E413" name="E413">E413</a><br>
<br>
When you want to use the same highlighting for several syntax groups, you<br>
can do this more easily by linking the groups into one common highlight<br>
group, and give the color attributes only for that group.<br>
<br>
To set a link:<br>
<br>
:hi[ghlight][!] <span class="Special">[default]</span> link <span class="Special">{from-group}</span> <span class="Special">{to-group}</span><br>
<br>
To remove a link:<br>
<br>
:hi[ghlight][!] <span class="Special">[default]</span> link <span class="Special">{from-group}</span> NONE<br>
<br>
<span class="Todo">Notes</span>: <a class="Constant" href="syntax.html#E414" name="E414">E414</a><br>
- If the <span class="Special">{from-group}</span> and/or <span class="Special">{to-group}</span> doesn't exist, it is created. You<br>
don't get an error message for a non-existing group.<br>
- As soon as you use a ":highlight" command for a linked group, the link is<br>
removed.<br>
- If there are already highlight settings for the <span class="Special">{from-group}</span>, the link is<br>
not made, unless the '!' is given. For a ":highlight link" command in a<br>
sourced file, you don't get an error message. This can be used to skip<br>
links for groups that already have settings.<br>
<br>
<a class="Constant" href="syntax.html#:hi-default" name=":hi-default">:hi-default</a> <a class="Constant" href="syntax.html#:highlight-default" name=":highlight-default">:highlight-default</a><br>
The <span class="Special">[default]</span> argument is used for setting the default highlighting for a<br>
group. If highlighting has already been specified for the group the command<br>
will be ignored. Also when there is an existing link.<br>
<br>
Using <span class="Special">[default]</span> is especially useful to overrule the highlighting of a<br>
specific syntax file. For example, the C syntax file contains:<br>
<div class="helpExample"> :highlight default link cComment Comment</div>
If you like Question highlighting for C comments, put this in your vimrc file:<br>
<div class="helpExample"> :highlight link cComment Question</div>
Without the "default" in the C syntax file, the highlighting would be<br>
overruled when the syntax file is loaded.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
14. Cleaning up <a class="Constant" href="syntax.html#:syn-clear" name=":syn-clear">:syn-clear</a> <a class="Constant" href="syntax.html#E391" name="E391">E391</a><br>
<br>
If you want to clear the syntax stuff for the current buffer, you can use this<br>
command:<br>
<div class="helpExample"> :syntax clear</div>
<br>
This command should be used when you want to switch off syntax highlighting,<br>
or when you want to switch to using another syntax. It's normally not needed<br>
in a syntax file itself, because syntax is cleared by the autocommands that<br>
load the syntax file.<br>
The command also deletes the "b:current_syntax" variable, since no syntax is<br>
loaded after this command.<br>
<br>
If you want to disable syntax highlighting for all buffers, you need to remove<br>
the autocommands that load the syntax files:<br>
<div class="helpExample"> :syntax off</div>
<br>
What this command actually does, is executing the command<br>
<div class="helpExample"> :source $VIMRUNTIME/syntax/nosyntax.vim</div>
See the "nosyntax.vim" file for details. <span class="Todo">Note</span> that for this to work<br>
$VIMRUNTIME must be valid. See <a class="Identifier" href="starting.html#$VIMRUNTIME">$VIMRUNTIME</a>.<br>
<br>
To clean up specific syntax groups for the current buffer:<br>
<div class="helpExample"> :syntax clear {group-name} ..</div>
This removes all patterns and keywords for <span class="Special">{group-name}</span>.<br>
<br>
To clean up specific syntax group lists for the current buffer:<br>
<div class="helpExample"> :syntax clear @{grouplist-name} ..</div>
This sets <span class="Special">{grouplist-name}</span>'s contents to an empty list.<br>
<br>
<a class="Constant" href="syntax.html#:syntax-reset" name=":syntax-reset">:syntax-reset</a> <a class="Constant" href="syntax.html#:syn-reset" name=":syn-reset">:syn-reset</a><br>
If you have changed the colors and messed them up, use this command to get the<br>
defaults back:<br>
<br>
<div class="helpExample"> :syntax reset</div>
<br>
It is a bit of a wrong name, since it does not reset any syntax items, it only<br>
affects the highlighting.<br>
<br>
This doesn't change the colors for the <a class="Type" href="options.html#'highlight'">'highlight'</a> option.<br>
<br>
<span class="Todo">Note</span> that the syntax colors that you set in your vimrc file will also be reset<br>
back to their Vim default.<br>
<span class="Todo">Note</span> that if you are using a color scheme, the colors defined by the color<br>
scheme for syntax highlighting will be lost.<br>
<br>
What this actually does is:<br>
<br>
<div class="helpExample"> let g:syntax_cmd = "reset"<br>
runtime! syntax/syncolor.vim</div>
<br>
<span class="Todo">Note</span> that this uses the <a class="Type" href="options.html#'runtimepath'">'runtimepath'</a> option.<br>
<br>
<a class="Constant" href="syntax.html#syncolor" name="syncolor">syncolor</a><br>
If you want to use different colors for syntax highlighting, you can add a Vim<br>
script file to set these colors. Put this file in a directory in<br>
<a class="Type" href="options.html#'runtimepath'">'runtimepath'</a> which comes after $VIMRUNTIME, so that your settings overrule<br>
the default colors. This way these colors will be used after the ":syntax<br>
reset" command.<br>
<br>
For Unix you can use the file ~/.vim/after/syntax/syncolor.vim. Example:<br>
<br>
<div class="helpExample"> if &background == "light"<br>
highlight comment ctermfg=darkgreen guifg=darkgreen<br>
else<br>
highlight comment ctermfg=green guifg=green<br>
endif</div>
<br>
<div class="helpExample"> *E679*</div>
Do make sure this syncolor.vim script does not use a "syntax on", set the<br>
<a class="Type" href="options.html#'background'">'background'</a> option or uses a "colorscheme" command, because it results in an<br>
endless loop.<br>
<br>
<span class="Todo">Note</span> that when a color scheme is used, there might be some confusion whether<br>
your defined colors are to be used or the colors from the scheme. This<br>
depends on the color scheme file. See <a class="Identifier" href="syntax.html#:colorscheme">:colorscheme</a>.<br>
<br>
<a class="Constant" href="syntax.html#syntax_cmd" name="syntax_cmd">syntax_cmd</a><br>
The "syntax_cmd" variable is set to one of these values when the<br>
syntax/syncolor.vim files are loaded:<br>
"on" ":syntax on" command. Highlight colors are overruled but<br>
links are kept<br>
"enable" ":syntax enable" command. Only define colors for groups that<br>
don't have highlighting yet. Use ":syntax default".<br>
"reset" ":syntax reset" command or loading a color scheme. Define all<br>
the colors.<br>
"skip" Don't define colors. Used to skip the default settings when a<br>
syncolor.vim file earlier in <a class="Type" href="options.html#'runtimepath'">'runtimepath'</a> has already set<br>
them.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
15. Highlighting tags <a class="Constant" href="syntax.html#tag-highlight" name="tag-highlight">tag-highlight</a><br>
<br>
If you want to highlight all the tags in your file, you can use the following<br>
mappings.<br>
<br>
<span class="Special"><F11></span> -- Generate tags.vim file, and highlight tags.<br>
<span class="Special"><F12></span> -- Just highlight tags based on existing tags.vim file.<br>
<br>
<div class="helpExample"> :map <F11> :sp tags<CR>:%s/^\([^ :]*:\)\=\([^ ]*\).*/syntax keyword Tag \2/<CR>:wq! tags.vim<CR>/^<CR><F12><br>
:map <F12> :so tags.vim<CR></div>
<br>
WARNING: The longer the tags file, the slower this will be, and the more<br>
memory Vim will consume.<br>
<br>
Only highlighting typedefs, unions and structs can be done too. For this you<br>
must use Exuberant ctags (found at <span class="Constant"><a href="http://ctags.sf.net">http://ctags.sf.net</a></span>).<br>
<br>
Put these lines in your Makefile:<br>
<br>
# Make a highlight file for types. Requires Exuberant ctags and awk<br>
types: types.vim<br>
types.vim: *.[ch]<br>
ctags --c-kinds=gstu -o- *.[ch] |\<br>
awk 'BEGIN{printf("syntax keyword Type\t")}\<br>
{printf("%s ", $$1)}END{print ""}' > $@<br>
<br>
And put these lines in your .vimrc:<br>
<br>
<div class="helpExample"> " load the types.vim highlighting file, if it exists<br>
autocmd BufRead,BufNewFile *.[ch] let fname = expand('<afile>:p:h') . '/types.vim'<br>
autocmd BufRead,BufNewFile *.[ch] if filereadable(fname)<br>
autocmd BufRead,BufNewFile *.[ch] exe 'so ' . fname<br>
autocmd BufRead,BufNewFile *.[ch] endif</div>
<br>
<span class="PreProc">==============================================================================</span><br>
16. Window-local syntax <a class="Constant" href="syntax.html#:ownsyntax" name=":ownsyntax">:ownsyntax</a><br>
<br>
Normally all windows on a buffer share the same syntax settings. It is<br>
possible, however, to set a particular window on a file to have its own<br>
private syntax setting. A possible example would be to edit LaTeX source<br>
with conventional highlighting in one window, while seeing the same source<br>
highlighted differently (so as to hide control sequences and indicate bold,<br>
italic etc regions) in another. The <a class="Type" href="options.html#'scrollbind'">'scrollbind'</a> option is useful here.<br>
<br>
To set the current window to have the syntax "foo", separately from all other<br>
windows on the buffer:<br>
<div class="helpExample"> :ownsyntax foo</div>
<a class="Constant" href="syntax.html#w:current_syntax" name="w:current_syntax">w:current_syntax</a><br>
This will set the "w:current_syntax" variable to "foo". The value of<br>
"b:current_syntax" does not change. This is implemented by saving and<br>
restoring "b:current_syntax", since the syntax files do set<br>
"b:current_syntax". The value set by the syntax file is assigned to<br>
"w:current_syntax".<br>
<span class="Todo">Note</span>: This resets the <a class="Type" href="options.html#'spell'">'spell'</a>, <a class="Type" href="options.html#'spellcapcheck'">'spellcapcheck'</a> and <a class="Type" href="options.html#'spellfile'">'spellfile'</a> options.<br>
<br>
Once a window has its own syntax, syntax commands executed from other windows<br>
on the same buffer (including :syntax clear) have no effect. Conversely,<br>
syntax commands executed from that window do not affect other windows on the<br>
same buffer.<br>
<br>
A window with its own syntax reverts to normal behavior when another buffer<br>
is loaded into that window or the file is reloaded.<br>
When splitting the window, the new window will use the original syntax.<br>
<br>
<span class="PreProc">==============================================================================</span><br>
17. Color xterms <a class="Constant" href="syntax.html#xterm-color" name="xterm-color">xterm-color</a> <a class="Constant" href="syntax.html#color-xterm" name="color-xterm">color-xterm</a><br>
<br>
Most color xterms have only eight colors. If you don't get colors with the<br>
default setup, it should work with these lines in your .vimrc:<br>
<div class="helpExample"> :if &term =~ "xterm"<br>
: if has("terminfo")<br>
: set t_Co=8<br>
: set t_Sf=<Esc>[3%p1%dm<br>
: set t_Sb=<Esc>[4%p1%dm<br>
: else<br>
: set t_Co=8<br>
: set t_Sf=<Esc>[3%dm<br>
: set t_Sb=<Esc>[4%dm<br>
: endif<br>
:endif</div>
[<span class="Special"><Esc></span> is a real escape, type <span class="Special">CTRL-V</span> <span class="Special"><Esc></span>]<br>
<br>
You might want to change the first "if" to match the name of your terminal,<br>
e.g. "dtterm" instead of "xterm".<br>
<br>
<span class="Todo">Note</span>: Do these settings BEFORE doing ":syntax on". Otherwise the colors may<br>
be wrong.<br>
<a class="Constant" href="syntax.html#xiterm" name="xiterm">xiterm</a> <a class="Constant" href="syntax.html#rxvt" name="rxvt">rxvt</a><br>
The above settings have been mentioned to work for xiterm and rxvt too.<br>
But for using 16 colors in an rxvt these should work with terminfo:<br>
<div class="helpExample"> :set t_AB=<Esc>[%?%p1%{8}%<%t25;%p1%{40}%+%e5;%p1%{32}%+%;%dm<br>
:set t_AF=<Esc>[%?%p1%{8}%<%t22;%p1%{30}%+%e1;%p1%{22}%+%;%dm</div>
<br>
<a class="Constant" href="syntax.html#colortest.vim" name="colortest.vim">colortest.vim</a><br>
To test your color setup, a file has been included in the Vim distribution.<br>
To use it, execute this command:<br>
<div class="helpExample"> :runtime syntax/colortest.vim</div>
<br>
Some versions of xterm (and other terminals, like the Linux console) can<br>
output lighter foreground colors, even though the number of colors is defined<br>
at 8. Therefore Vim sets the "cterm=bold" attribute for light foreground<br>
colors, when <a class="Type" href="term.html#'t_Co'">'t_Co'</a> is 8.<br>
<br>
<a class="Constant" href="syntax.html#xfree-xterm" name="xfree-xterm">xfree-xterm</a><br>
To get 16 colors or more, get the newest xterm version (which should be<br>
included with XFree86 3.3 and later). You can also find the latest version<br>
at:<br>
<div class="helpExample"> <a href="http://invisible-island.net/xterm/xterm.html">http://invisible-island.net/xterm/xterm.html</a></div>
Here is a good way to configure it. This uses 88 colors and enables the<br>
termcap-query feature, which allows Vim to ask the xterm how many colors it<br>
supports.<br>
<div class="helpExample"> ./configure --disable-bold-color --enable-88-color --enable-tcap-query</div>
If you only get 8 colors, check the xterm compilation settings.<br>
(Also see <a class="Identifier" href="mbyte.html#UTF8-xterm">UTF8-xterm</a> for using this xterm with UTF-8 character encoding).<br>
<br>
This xterm should work with these lines in your .vimrc (for 16 colors):<br>
<div class="helpExample"> :if has("terminfo")<br>
: set t_Co=16<br>
: set t_AB=<Esc>[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm<br>
: set t_AF=<Esc>[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm<br>
:else<br>
: set t_Co=16<br>
: set t_Sf=<Esc>[3%dm<br>
: set t_Sb=<Esc>[4%dm<br>
:endif</div>
[<span class="Special"><Esc></span> is a real escape, type <span class="Special">CTRL-V</span> <span class="Special"><Esc></span>]<br>
<br>
Without <a class="Identifier" href="various.html#+terminfo">+terminfo</a>, Vim will recognize these settings, and automatically<br>
translate cterm colors of 8 and above to "<span class="Special"><Esc></span>[9%dm" and "<span class="Special"><Esc></span>[10%dm".<br>
Colors above 16 are also translated automatically.<br>
<br>
For 256 colors this has been reported to work:<br>
<br>
<div class="helpExample"> :set t_AB=<Esc>[48;5;%dm<br>
:set t_AF=<Esc>[38;5;%dm</div>
<br>
Or just set the TERM environment variable to "xterm-color" or "xterm-16color"<br>
and try if that works.<br>
<br>
You probably want to use these X resources (in your ~/.Xdefaults file):<br>
XTerm*color0: #000000<br>
XTerm*color1: #c00000<br>
XTerm*color2: #008000<br>
XTerm*color3: #808000<br>
XTerm*color4: #0000c0<br>
XTerm*color5: #c000c0<br>
XTerm*color6: #008080<br>
XTerm*color7: #c0c0c0<br>
XTerm*color8: #808080<br>
XTerm*color9: #ff6060<br>
XTerm*color10: #00ff00<br>
XTerm*color11: #ffff00<br>
XTerm*color12: #8080ff<br>
XTerm*color13: #ff40ff<br>
XTerm*color14: #00ffff<br>
XTerm*color15: #ffffff<br>
Xterm*cursorColor: Black<br>
<br>
[<span class="Todo">Note</span>: The cursorColor is required to work around a bug, which changes the<br>
cursor color to the color of the last drawn text. This has been fixed by a<br>
newer version of xterm, but not everybody is using it yet.]<br>
<br>
To get these right away, reload the .Xdefaults file to the X Option database<br>
Manager (you only need to do this when you just changed the .Xdefaults file):<br>
<div class="helpExample"> xrdb -merge ~/.Xdefaults</div>
<br>
<a class="Constant" href="syntax.html#xterm-blink" name="xterm-blink">xterm-blink</a> <a class="Constant" href="syntax.html#xterm-blinking-cursor" name="xterm-blinking-cursor">xterm-blinking-cursor</a><br>
To make the cursor blink in an xterm, see tools/blink.c. Or use Thomas<br>
Dickey's xterm above patchlevel 107 (see above for where to get it), with<br>
these resources:<br>
XTerm*cursorBlink: on<br>
XTerm*cursorOnTime: 400<br>
XTerm*cursorOffTime: 250<br>
XTerm*cursorColor: White<br>
<br>
<a class="Constant" href="syntax.html#hpterm-color" name="hpterm-color">hpterm-color</a><br>
These settings work (more or less) for an hpterm, which only supports 8<br>
foreground colors:<br>
<div class="helpExample"> :if has("terminfo")<br>
: set t_Co=8<br>
: set t_Sf=<Esc>[&v%p1%dS<br>
: set t_Sb=<Esc>[&v7S<br>
:else<br>
: set t_Co=8<br>
: set t_Sf=<Esc>[&v%dS<br>
: set t_Sb=<Esc>[&v7S<br>
:endif</div>
[<span class="Special"><Esc></span> is a real escape, type <span class="Special">CTRL-V</span> <span class="Special"><Esc></span>]<br>
<br>
<a class="Constant" href="syntax.html#Eterm" name="Eterm">Eterm</a> <a class="Constant" href="syntax.html#enlightened-terminal" name="enlightened-terminal">enlightened-terminal</a><br>
These settings have been reported to work for the Enlightened terminal<br>
emulator, or Eterm. They might work for all xterm-like terminals that use the<br>
bold attribute to get bright colors. Add an ":if" like above when needed.<br>
<div class="helpExample"> :set t_Co=16<br>
:set t_AF=^[[%?%p1%{8}%<%t3%p1%d%e%p1%{22}%+%d;1%;m<br>
:set t_AB=^[[%?%p1%{8}%<%t4%p1%d%e%p1%{32}%+%d;1%;m</div>
<br>
<a class="Constant" href="syntax.html#TTpro-telnet" name="TTpro-telnet">TTpro-telnet</a><br>
These settings should work for TTpro telnet. Tera Term Pro is a freeware /<br>
open-source program for MS-Windows.<br>
<div class="helpExample"> set t_Co=16<br>
set t_AB=^[[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{32}%+5;%;%dm<br>
set t_AF=^[[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{22}%+1;%;%dm</div>
Also make sure TTpro's Setup / Window / Full Color is enabled, and make sure<br>
that Setup / Font / Enable Bold is NOT enabled.<br>
(info provided by John Love-Jensen <eljay@Adobe.COM>)<br>
<br>
<br>
<span class="PreProc">==============================================================================</span><br>
18. When syntax is slow <a class="Constant" href="syntax.html#:syntime" name=":syntime">:syntime</a><br>
<br>
This is aimed at authors of a syntax file.<br>
<br>
If your syntax causes redrawing to be slow, here are a few hints on making it<br>
faster. To see slowness switch on some features that usually interfere, such<br>
as <a class="Type" href="options.html#'relativenumber'">'relativenumber'</a> and <a class="Identifier" href="fold.html#folding">folding</a>.<br>
<br>
<span class="Todo">Note</span>: this is only available when compiled with the <a class="Identifier" href="various.html#+profile">+profile</a> feature.<br>
You many need to build Vim with "huge" features.<br>
<br>
To find out what patterns are consuming most time, get an overview with this<br>
sequence:<br>
<div class="helpExample"> :syntime on<br>
[ redraw the text at least once with CTRL-L ]<br>
:syntime report</div>
<br>
This will display a list of syntax patterns that were used, sorted by the time<br>
it took to match them against the text.<br>
<br>
:syntime on Start measuring syntax times. This will add some<br>
overhead to compute the time spent on syntax pattern<br>
matching.<br>
<br>
:syntime off Stop measuring syntax times.<br>
<br>
:syntime clear Set all the counters to zero, restart measuring.<br>
<br>
:syntime report Show the syntax items used since ":syntime on" in the<br>
current window. Use a wider display to see more of<br>
the output.<br>
<br>
The list is sorted by total time. The columns are:<br>
TOTAL Total time in seconds spent on<br>
matching this pattern.<br>
COUNT Number of times the pattern was used.<br>
MATCH Number of times the pattern actually<br>
matched<br>
SLOWEST The longest time for one try.<br>
AVERAGE The average time for one try.<br>
NAME Name of the syntax item. <span class="Todo">Note</span> that<br>
this is not unique.<br>
PATTERN The pattern being used.<br>
<br>
Pattern matching gets slow when it has to try many alternatives. Try to<br>
include as much literal text as possible to reduce the number of ways a<br>
pattern does NOT match.<br>
<br>
When using the "\@<=" and "\@<!" items, add a maximum size to avoid trying at<br>
all positions in the current and previous line. For example, if the item is<br>
literal text specify the size of that text (in bytes):<br>
<br>
"<\@<=span" Matches "span" in "<span". This tries matching with "<" in<br>
many places.<br>
"<\@1<=span" Matches the same, but only tries one byte before "span".<br>
<br>
<br>
vim:tw=78:sw=4:ts=8:ft=help:norl:<br>
</div>
</article>
<footer>
<a href="#top">Return to the top</a> - <a href="index.html">Return to main</a>
<span class="EnglishJapaneseLink">
<span class="CurrentLanguage">English</span>
</span>
<br />
<div style="text-align:right;">
Hosted by <a href="https://github.com/vim-jp/vimdoc-en">vimdoc-en project</a><br />
If you met any problem, please report it to <a href="https://github.com/vim-jp/vimdoc-en/issues">issue</a>.<br />
</div>
</footer>
<!--<script src="js/check-referrer.js" type="text/javascript"></script>-->
</body>
</html>
<!-- vim:set ts=8 sts=2 sw=2 tw=0 et: -->
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。