completion window. <Right> is not recognized on most Unix
systems, so this maps is only created on the Windows platform.
If you would like the same feature on Unix, choose a different key
and make the same map in your vimrc. >
<Left>
< - Displays the list of tables.
<Left> is not recognized on most Unix systems, so this maps is
only created on the Windows platform. If you would like the same
feature on Unix, choose a different key and make the same map in
your vimrc. >
<C-C>R
< - This maps removes all cached items and forces the SQL completion
to regenerate the list of items.
Customizing Maps ~
You can create as many additional key maps as you like. Generally, the maps
will be specifying different syntax highlight groups.
If you do not wish the default maps created or the key choices do not work on
your platform (often a case on unix) you define the following variable in
your |init.vim|: >
let g:omni_sql_no_default_maps = 1
Do not edit ftplugin/sql.vim directly! If you change this file your changes
will be over written on future updates. Vim has a special directory structure
which allows you to make customizations without changing the files that are
included with the Vim distribution. If you wish to customize the maps
create an after/ftplugin/sql.vim (see |after-directory|) and place the same
maps from the ftplugin/sql.vim in it using your own key strokes. <C-C> was
chosen since it will work on both Windows and unix platforms. On the windows
platform you can also use <C-Space> or ALT keys.
------------------------------------------------------------------------------
4.6 Using with other filetypes *sql-completion-filetypes*
Many times SQL can be used with different filetypes. For example Perl, Java,
PHP, Javascript can all interact with a database. Often you need both the SQL
completion and the completion capabilities for the current language you are
editing.
This can be enabled easily with the following steps (assuming a Perl file): >
1. :e test.pl
2. :set filetype=sql
3. :set ft=perl
Step 1 ~
Begins by editing a Perl file. Vim automatically sets the filetype to
"perl". By default, Vim runs the appropriate filetype file
ftplugin/perl.vim. If you are using the syntax completion plugin by following
the directions at |ft-syntax-omni| then the |'omnifunc'| option has been set to
"syntax#Complete". Pressing <C-X><C-O> will display the omni popup containing
the syntax items for Perl.
Step 2 ~
Manually setting the filetype to "sql" will also fire the appropriate filetype
files ftplugin/sql.vim. This file will define a number of buffer specific
maps for SQL completion, see |sql-completion-maps|. Now these maps have
been created and the SQL completion plugin has been initialized. All SQL
syntax items have been cached in preparation. The SQL filetype script detects
we are attempting to use two different completion plugins. Since the SQL maps
begin with <C-C>, the maps will toggle the |'omnifunc'| when in use. So you
can use <C-X><C-O> to continue using the completion for Perl (using the syntax
completion plugin) and <C-C> to use the SQL completion features.
Step 3 ~
Setting the filetype back to Perl sets all the usual "perl" related items back
as they were.
vim:tw=78:ts=8:noet:ft=help:norl: