within the omni completion list.
Some people may find this list unwieldy or are only interested in certain
items. There are two ways to prune this list (if necessary). If you find
certain syntax groups you do not wish displayed you can use two different
methods to identify these groups. The first specifically lists the syntax
groups by name. The second uses a regular expression to identify both
syntax groups. Simply add one the following to your vimrc: >
let g:omni_syntax_group_exclude_php = 'phpCoreConstant,phpConstant'
let g:omni_syntax_group_exclude_php = 'php\w*Constant'
Add as many syntax groups to this list by comma separating them. The basic
form of this variable is: >
let g:omni_syntax_group_exclude_{filetype} = 'regex,comma,separated'
You can create as many of these variables as you need, varying only the
filetype at the end of the variable name.
The plugin uses the isKeyword option to determine where word boundaries are
for the syntax items. For example, in the Scheme language completion should
include the "-", call-with-output-file. Depending on your filetype, this may
not provide the words you are expecting. Setting the
g:omni_syntax_use_iskeyword option to 0 will force the syntax plugin to break
on word characters. This can be controlled adding the following to your
vimrc: >
let g:omni_syntax_use_iskeyword = 0
For plugin developers, the plugin exposes a public function OmniSyntaxList.
This function can be used to request a List of syntax items. When editing a
SQL file (:e syntax.sql) you can use the ":syntax list" command to see the
various groups and syntax items. For example: >
syntax list
Yields data similar to this:
sqlOperator xxx some prior all like and any escape exists in is not ~
or intersect minus between distinct ~
links to Operator ~
sqlType xxx varbit varchar nvarchar bigint int uniqueidentifier ~
date money long tinyint unsigned xml text smalldate ~
double datetime nchar smallint numeric time bit char ~
varbinary binary smallmoney ~
image float integer timestamp real decimal ~
There are two syntax groups listed here: sqlOperator and sqlType. To retrieve
a List of syntax items you can call OmniSyntaxList a number of different
ways. To retrieve all syntax items regardless of syntax group: >
echo OmniSyntaxList( [] )
To retrieve only the syntax items for the sqlOperator syntax group: >
echo OmniSyntaxList( ['sqlOperator'] )
To retrieve all syntax items for both the sqlOperator and sqlType groups: >
echo OmniSyntaxList( ['sqlOperator', 'sqlType'] )
A regular expression can also be used: >
echo OmniSyntaxList( ['sql\w\+'] )
From within a plugin, you would typically assign the output to a List: >
let myKeywords = []
let myKeywords = OmniSyntaxList( ['sqlKeyword'] )
SQL *ft-sql-omni*
Completion 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