for the SQL language includes statements, functions, keywords.
It will also dynamically complete tables, procedures, views and column lists
with data pulled directly from within a database. For detailed instructions
and a tutorial see |omni-sql-completion|.
The SQL completion plugin can be used in conjunction with other completion
plugins. For example, the PHP filetype has its own completion plugin.
Since PHP is often used to generate dynamic website by accessing a database,
the SQL completion plugin can also be enabled. This allows you to complete
PHP code and SQL code at the same time.
XML *ft-xml-omni*
Vim 7 provides a mechanism for context aware completion of XML files. It
depends on a special |xml-omni-datafile| and two commands: |:XMLns| and
|:XMLent|. Features are:
- after "<" complete the tag name, depending on context
- inside of a tag complete proper attributes
- when an attribute has a limited number of possible values help to complete
them
- complete names of entities (defined in |xml-omni-datafile| and in the
current file with "<!ENTITY" declarations)
- when used after "</" CTRL-X CTRL-O will close the last opened tag
Format of XML data file *xml-omni-datafile*
XML data files are stored in the "autoload/xml" directory in 'runtimepath'.
Vim distribution provides examples of data files in the
"$VIMRUNTIME/autoload/xml" directory. They have a meaningful name which will
be used in commands. It should be a unique name which will not create
conflicts. For example, the name xhtml10s.vim means it is the data file for
XHTML 1.0 Strict.
Each file contains a variable with a name like g:xmldata_xhtml10s . It is
a compound from two parts:
1. "g:xmldata_" general prefix, constant for all data files
2. "xhtml10s" the name of the file and the name of the described XML
dialect; it will be used as an argument for the |:XMLns|
command
Part two must be exactly the same as name of file.
The variable is a |Dictionary|. Keys are tag names and each value is a two
element |List|. The first element of the List is also a List with the names
of possible children. The second element is a |Dictionary| with the names of
attributes as keys and the possible values of attributes as values. Example: >
let g:xmldata_crippled = {
\ "vimxmlentities": ["amp", "lt", "gt", "apos", "quot"],
\ 'vimxmlroot': ['tag1'],
\ 'tag1':
\ [ ['childoftag1a', 'childoftag1b'], {'attroftag1a': [],
\ 'attroftag1b': ['valueofattr1', 'valueofattr2']}],
\ 'childoftag1a':
\ [ [], {'attrofchild': ['attrofchild']}],
\ 'childoftag1b':
\ [ ['childoftag1a'], {'attrofchild': []}],
\ "vimxmltaginfo": {
\ 'tag1': ['Menu info', 'Long information visible in preview window']},
\ 'vimxmlattrinfo': {
\ 'attrofchild': ['Menu info', 'Long information visible in preview window']}}
This example would be put in the "autoload/xml/crippled.vim" file and could
help to write this file: >
<tag1 attroftag1b="valueofattr1">
<childoftag1a attrofchild>
& <
</childoftag1a>
<childoftag1b attrofchild="5">
<childoftag1a>
> ' "
</childoftag1a>
</childoftag1b>
</tag1>
In the example four special elements are visible:
1. "vimxmlentities" - a special key with List containing entities of this XML
dialect.
2. If the list containing possible values of attributes has one element and
this element is equal to the name of the attribute this attribute will be
treated as boolean and inserted as "attrname" and not as 'attrname="'
3. "vimxmltaginfo" - a special key with a Dictionary containing tag
names as keys and two element List as values, for additional menu info and
the long description.
4. "vimxmlattrinfo" - special key with Dictionary containing attribute names
as keys and two element List as values, for additional menu info and long
description.
Note: Tag names in the data