ft_sql.txt ForVim version 9.2. Last change: 2026 Feb 14by David FishburnThisisafiletypeplugin to work with SQL files.The Structured Query Language (SQL)isa standard whichspecifies statementsthat allowa user to interact witha relational database. Vim includesfeatures for navigation, indentation andsyntax highlighting.1. Navigationsql-navigation 1.1 Matchitsql-matchit 1.2 TextObject Motionssql-object-motions 1.3 PredefinedObject Motionssql-predefined-objects 1.4 Macrossql-macros2. SQL Dialectssql-dialects 2.1SQLSetTypeSQLSetType 2.2SQLGetTypeSQLGetType 2.3 SQL Dialect Defaultsql-type-default3. Adding new SQL Dialectssql-adding-dialects4. OMNI SQL Completionsql-completion 4.1 Static modesql-completion-static 4.2 Dynamic modesql-completion-dynamic 4.3 Tutorialsql-completion-tutorial4.3.1 Complete Tablessql-completion-tables4.3.2 Complete Columnssql-completion-columns4.3.3 Complete Proceduressql-completion-procedures4.3.4 Complete Viewssql-completion-views 4.4 Completion Customizationsql-completion-customization 4.5 SQL Mapssql-completion-maps 4.6 Using with otherfiletypessql-completion-filetypes==============================================================================1. Navigationsql-navigationThe SQLftplugin providesa number ofoptions to assist with filenavigation.1.1 Matchitsql-matchit-----------Thematchitplugin (http://www.vim.org/scripts/script.php?script_id=39)provides many additional features and can be customized for differentlanguages. Thematchitpluginis configured by defininga localbuffer variable, b:match_words. Pressing the% key while onvariouskeywords will move the cursor to its match. For example, if the cursoris on an "if", pressing% will cycle between the "else", "elseif" and"end if" keywords.The following keywords are supported: if elseif | elsif else [if] end if [while condition] loopleavebreakcontinueexit end loop forleavebreakcontinueexit end loop dostatements doend case when when default end case merge when not matched when matched create[ or replace] procedure|function|event returns1.2 TextObject Motionssql-object-motions-----------------------Vim hasa number of predefined keys for working with textobject-motions.Thisfiletypeplugin attempts to translate these keys to maps which make sensefor the SQL language.The followingNormal mode andVisual mode maps exist (when you edita SQLfile): ]] move forward to the next 'begin' [[ move backwards to the previous 'begin' ][ move forward to the next 'end' [] move backwards to the previous 'end'1.3 PredefinedObject Motionssql-predefined-objects-----------------------------Most relational databases supportvarious standard features, tables, indices,triggers and stored procedures. Each vendor also hasa variety of proprietaryobjects. The next set of maps have been created tohelp move between theseobjects. Depends on which database vendor you are using, thelist ofobjectsmust be configurable. Thefiletypeplugin attempts to define many of thestandard objects, plus many additional ones. In order to make thisasflexibleas possible, you can override thelist ofobjects from within yourvimrc with the following: let g:ftplugin_sql_objects = 'function,procedure,event,table,trigger' ..\ ',schema,service,publication,database,datatype,domain' ..\ ',index,subscription,synchronization,view,variable'The followingNormal mode andVisual mode maps have been created which usethe above list: ]} move forward to the next 'create <object name>' [{ move backward to the previous 'create <object name>'Repeatedly pressing]} will cycle through each of these create statements: create table t1 (... ); create procedure p1 begin... end; create index i1 on t1 (c1);The default setting for g:ftplugin_sql_objects is: let g:ftplugin_sql_objects = 'function,procedure,event,' ..\ '\\(existing\\\\|global\\s\\+temporary\\s\\+\\)\\\{,1}' ..\ 'table,trigger' ..\ ',schema,service,publication,database,datatype,domain' ..\ ',index,subscription,synchronization,view,variable'The above will also handle these cases: create table t1 (... ); create existing table t2 (... ); create global temporary table t3 (... );By default, theftplugin only searches for CREATE statements. You can alsooverride this via yourvimrc with the following: let g:ftplugin_sql_statements = 'create,alter'Thefiletypeplugin defines three types of comments: 1. -- 2. // 3. /* * */The followingNormal mode andVisual mode maps have been created to workwith comments: ]" move forward to the beginning of a comment [" move forward to the end of a comment1.4 Macrossql-macros----------Vim's feature to findmacro definitions,'define',is supported using thisregular expression: \c\<\(VARIABLE\|DECLARE\|IN\|OUT\|INOUT\)\>This addresses the following code: CREATE VARIABLE myVar1 INTEGER; CREATE PROCEDURE sp_test(IN myVar2 INTEGER,OUT myVar3 CHAR(30),INOUT myVar4 NUMERIC(20,0) ) BEGINDECLARE myVar5 INTEGER;SELECT c1, c2, c3 INTO myVar2, myVar3, myVar4 FROM T1 WHERE c4 = myVar1; END;Place your cursor on "myVar1" on this line: WHERE c4 = myVar1; ^Press any of the following keys: [d [D [CTRL-D==============================================================================2. SQL Dialectssql-dialectssql-typessybaseTSQLTransact-SQLsqlanywhereoracleplsqlsqljsqlservermysqlpostgresqlpsqlinformixAll relational databases support SQL. Thereisa portion of SQL thatisportable across vendors (ex. CREATE TABLE, CREATE INDEX), but thereisagreat deal of vendor specific extensions to SQL. Oracle supports the"CREATE OR REPLACE" syntax, column defaults specified in the CREATE TABLEstatement and the procedural language (for stored procedures and triggers).The default Vimdistribution ships withsyntax highlighting based on Oracle'sPL/SQL. The default SQL indentscript works for Oracle and SQL Anywhere.The defaultfiletypeplugin works for all vendors and should remain vendorneutral, but extendable.Vim currently has support fora variety of different vendors, currently thisis viasyntax scripts. Unfortunately, to flip between differentsyntax rulesyoumust either create: 1. Newfiletypes 2. Custom autocmds 3. Manual steps/ commandsThe majority of people work with only one vendor's database product,it wouldbe nice to specifya default in yourvimrc.2.1SQLSetTypesqlsettypeSQLSetType--------------For the people that work with many different databases,itis nice to beable to flip between thevarious vendors rules (indent, syntax) ona perbuffer basis,at any time. The ftplugin/sql.vim file defines this function: SQLSetTypeExecuting this function without any parameters will set the indent andsyntaxscripts back to their defaults, seesql-type-default. If you have turnedoff Vi's compatibility mode,'compatible', you can use the<Tab> key tocomplete the optional parameter.After typing the function name anda space, you can use the completion tosupplya parameter. The function takes the name of the Vimscript you want tosource. Using thecmdline-completion feature, theSQLSetType function willsearch the'runtimepath' for all Vim scripts witha name containing'sql'.This takes the guess work out of the spelling of the names. The following areexamples: :SQLSetType :SQLSetType sqloracle :SQLSetType sqlanywhere :SQLSetType sqlinformix :SQLSetType mysqlThe easiest approachis to the use<Tab> character which will first completethe command name (SQLSetType), afteraspace and another<Tab>, displayalistof available Vimscript names: :SQL<Tab><space><Tab>2.2SQLGetTypesqlgettypeSQLGetType--------------At anytime you can determine which SQL dialect you are using by calling theSQLGetType command. The ftplugin/sql.vim file defines this function: SQLGetTypeThis will echo: Current SQL dialect in use:sqlanywhere2.3 SQL Dialect Defaultsql-type-default-----------------------As mentioned earlier, the defaultsyntax rules for Vimis based on Oracle(PL/SQL). You can override this default by placing one of the following inyourvimrc: let g:sql_type_default = 'sqlanywhere' let g:sql_type_default = 'sqlinformix' let g:sql_type_default = 'mysql'If you added the following to yourvimrc: let g:sql_type_default = 'sqlinformix'The next time edita SQL file the following scripts will be automaticallyloaded by Vim: ftplugin/sql.vim syntax/sqlinformix.vim indent/sql.vimNotice indent/sqlinformix.sql was not loaded. Thereis no indent filefor Informix, Vim loads the default files if the specified files does notexist.==============================================================================3. Adding new SQL Dialectssql-adding-dialectsIf you begin working witha SQL dialect which does not have any customizationsavailable with the default Vimdistribution you can checkhttp://www.vim.orgto see if any customization currently exist. If not, you can begin by cloningan existing script. Readfiletype-plugins for more details.Tohelp identify these scripts, try to create the files witha "sql" prefix.If you decide you wish to create customizations for the SQLite database, youcan create any of the following: Unix~/.vim/syntax/sqlite.vim~/.vim/indent/sqlite.vim Windows$VIM/vimfiles/syntax/sqlite.vim$VIM/vimfiles/indent/sqlite.vimNo changes are necessary to theSQLSetType function. It will automaticallypick up the new SQL files and load them when you issue theSQLSetType command.==============================================================================4. OMNI SQL Completionsql-completionomni-sql-completionVim 7 includesa code completioninterface andfunctions which allowsplugindevelopers to build in code completion for any language. Vim 7 includescode completion for the SQL language.There are two modes to the SQL completion plugin, static and dynamic. Thestatic mode populates the popups with the data generated from currentsyntaxhighlight rules. The dynamic mode populates the popups with data retrieveddirectly froma database. This includes, table lists, column lists,procedures names and more.4.1 Static Modesql-completion-static---------------The static popups created contain items defined by the activesyntax ruleswhile editinga file withafiletype of SQL. Theplugin defines (by default)various maps tohelp the user refine thelist of items to be displayed.The defaults static maps are: imap <buffer> <C-C>a <C-\><C-O>:call sqlcomplete#Map('syntax')<CR><C-X><C-O> imap <buffer> <C-C>k <C-\><C-O>:call sqlcomplete#Map('sqlKeyword')<CR><C-X><C-O> imap <buffer> <C-C>f <C-\><C-O>:call sqlcomplete#Map('sqlFunction')<CR><C-X><C-O> imap <buffer> <C-C>o <C-\><C-O>:call sqlcomplete#Map('sqlOption')<CR><C-X><C-O> imap <buffer> <C-C>T <C-\><C-O>:call sqlcomplete#Map('sqlType')<CR><C-X><C-O> imap <buffer> <C-C>s <C-\><C-O>:call sqlcomplete#Map('sqlStatement')<CR><C-X><C-O>The use of "<C-C>" can be user chosen by using the following in your.vimrcasit may not work properly on all platforms: let g:ftplugin_sql_omni_key = '<C-C>'The static maps (which are based on thesyntax highlight groups) follow thisformat: imap <buffer> <C-C>k <C-\><C-O>:call sqlcomplete#Map('sqlKeyword')<CR><C-X><C-O> imap <buffer> <C-C>k <C-\><C-O>:call sqlcomplete#Map('sqlKeyword\w*')<CR><C-X><C-O>This command breaks down as: imap - Create an insert map <buffer> - Only for this buffer <C-C>k - Your choice of key map <C-\><C-O> - Execute one command, return to Insert mode :call sqlcomplete#Map( - Allows the SQL completion plugin to perform some housekeeping functions to allow it to be used in conjunction with other completion plugins. Indicate which item you want the SQL completion plugin to complete. In this case we are asking the plugin to display items from the syntax highlight group 'sqlKeyword'. You can view a list of highlight group names to choose from by executing the :syntax list command while editing a SQL file. 'sqlKeyword' - Display the items for the sqlKeyword highlight group 'sqlKeyword\w*' - A second option available with Vim 7.4 which uses a regular expression to determine which syntax groups to use )<CR> - Execute the :let command <C-X><C-O> - Trigger the standard omni completion key stroke. Passing in 'sqlKeyword' instructs the SQL completion plugin to populate the popup with items from the sqlKeyword highlight group. The plugin will also cache this result until Vim is restarted. The syntax list is retrieved using the syntaxcomplete plugin.Using the'syntax' keywordisa special case. This instructs thesyntaxcompleteplugin to retrieve allsyntax items. So this will effectivelywork for any of Vim's SQLsyntax files. At the time ofwriting this includes10 differentsyntax files for the different dialects of SQL (seesection 3above,sql-dialects).Here are some examples of the entries which are pulled from thesyntax files: All - Contains the contents of all syntax highlight groups Statements - Select, Insert, Update, Delete, Create, Alter, ... Functions - Min, Max, Trim, Round, Date, ... Keywords - Index, Database, Having, Group, With Options - Isolation_level, On_error, Qualify_owners, Fire_triggers, ... Types - Integer, Char, Varchar, Date, DateTime, Timestamp, ...4.2 Dynamic Modesql-completion-dynamic----------------Dynamic mode populates the popups with data directly froma database. Inorder for the dynamic feature to be enabled youmust have the dbext.vimplugin installed, (https://www.vim.org/scripts/script.php?script_id=356).Dynamic modeis used by several features of the SQL completion plugin.After installing the dbextplugin see the dbext-tutorial for additionalconfiguration and usage. The dbextplugin allows the SQL completionpluginto displayalist of tables, procedures, views and columns. Table List - All tables for all schema owners Procedure List - All stored procedures for all schema owners View List - All stored procedures for all schema owners Column List - For the selected table, the columns that are part of the tableTo enable the popup, while in INSERT mode, use the following key combinationsfor each group (where<C-C> means hold the CTRL key down while pressingthespace bar): TableList-<C-C>t-<C-X><C-O> (the default map assumes tables) Stored ProcedureList-<C-C>pViewList-<C-C>v ColumnList-<C-C>c Drilling In/ Out- When viewingapopupwindow displaying thelist of tables, you can press<Right>, this will replace the table currently highlighted with the columnlist for that table.- When viewingapopupwindow displaying thelist of columns, you can press<Left>, this will replace the columnlist with thelist of tables.- This allows you to quickly drill down intoa table toview its columns and back again.-<Right> and<Left> can also be chosen via your.vimrc let g:ftplugin_sql_omni_key_right = '<Right>' let g:ftplugin_sql_omni_key_left = '<Left>'The SQL completionplugin cachesvarious lists that are displayed inthepopup window. This makes the re-displaying of these lists veryfast. If new tables or columns are added to the databaseit may becomenecessary to clear the plugins cache. The default map for this is: imap <buffer> <C-C>R <C-\><C-O>:call sqlcomplete#Map('ResetCache')<CR><C-X><C-O>4.3 SQL Tutorialsql-completion-tutorial----------------This tutorialis designed to take you through the common features of the SQLcompletionplugin so that: a) You gain familiarity with the plugin b) You are introduced to some of the more common features c) Show how to customize it to your preferences d) Demonstrate "Best of Use" of the plugin (easiest way to configure).First, createa new buffer: :e tutorial.sqlStatic features---------------To take you through thevarious lists, simply enterinsert mode, hit:<C-C>s (show SQL statements)At this point, you can page down through thelist until you find "select".If you are familiar with the item you are looking for, for example you knowthe statement begins with theletter "s". You can type ahead (without thequotes) "se" then press:<C-Space>tAssuming "select"is highlighted in thepopuplist press<Enter> to choosethe entry. Now type: * fr<C-C>a (show allsyntax items)choose "from" from thepopup list.Whenwriting stored procedures using the "type"listis useful. It containsalist of all the database supported types. This may or may not betruedepending on thesyntax file you are using. The SQL Anywheresyntax file(sqlanywhere.vim) has support for this: BEGINDECLARE customer_id <C-C>T <-- Choose a type from the listDynamic features----------------To take advantage of the dynamic features youmust firstinstall thedbext.vimplugin (https://www.vim.org/scripts/script.php?script_id=356). Italso comes witha tutorial. From the SQL completion plugin's perspective,the main feature dbext providesisa connection toa database. dbextconnection profiles are the most efficient mechanism to define connectioninformation. Once connections have been setup, the SQL completionpluginuses the features of dbext in the background to populate the popups.What follows assumes dbext.vim has been correctly configured,a simple testis to run the command, :DBListTable. Ifalist of tablesis shown, you knowdbext.vimis workingas expected. If not, please consult the dbext.txtdocumentation.Assuming you have followed the dbext-tutorial you can press<C-C>t todisplayalist of tables. Thereisa delay while dbextis creating the tablelist. After thelistis displayed press<C-W>. This will remove both thepopupwindow and the table name already chosen when thelist became active. 4.3.1 Table Completion:sql-completion-tablesPress<C-C>t to displayalist of tables from within the database youhave connected via the dbext plugin.NOTE: All of the SQL completion popups support typinga prefix before pressingthe key map. This will limit the contents of thepopupwindow to just itemsbeginning with those characters. 4.3.2 Column Completion:sql-completion-columnsThe SQL completionplugin can also displayalist of columns for particulartables. The column completionis triggered via<C-C>c.NOTE: The following example uses<Right> to triggera columnlist while thepopupwindowis active.Example of using column completion:- Press<C-C>t again to display thelist of tables.- When thelistis displayed in the completion window, press<Right>, this will replace thelist of tables, withalist of columns for the table highlighted (after the same short delay).- If you press<Left>, this will again replace the columnlist with thelist of tables. This allows you to drill into tables and column lists very quickly.- Press<Right> again while the same tableis highlighted. You will notice thereis no delay since the columnlist has been cached. If you change the schema ofa cached table you can press<C-C>R, which clears the SQL completion cache.-NOTE:<Right> and<Left> have been designed to work while the completionwindowis active. If the completionpopupwindowis not active,a normal<Right> or<Left> will be executed.Let's lookat how we can builda SQL statement dynamically.A select statementrequiresalist of columns. There are two ways to builda columnlist usingthe SQL completion plugin. One column at a time: 1. After typing SELECT press<C-C>t to displayalist of tables.2. Choosea table from the list.3. Press<Right> to displayalist of columns.4. Choose the column from thelist and press enter.5. Entera "," and press<C-C>c. Generatinga columnlist generally requires having the cursor ona table name. Theplugin uses this name to determine what table to retrieve the column list. In this step, since we are pressing<C-C>c without the cursor ona table name the columnlist displayed will be for the previous table. Choosea different column and move on.6. Repeat step 5as oftenas necessary. All columns for a table:1. After typing SELECT press<C-C>t to displayalist of tables.2. Highlight the table you need the columnlist for.3. Press<Enter> to choose the table from the list.4. Press<C-C>l to requesta comma-separatedlist of all columns for this table.5. Based on the table name chosen in step 3, theplugin attempts to decide ona reasonable table alias.You are then prompted to either accept of change the alias. Press OK.6. The table nameis replaced with the columnlist of the tableis replaced with the comma separatelist of columns with the alias prepended to each of the columns.7. Step 3 and 4 can be replaced by pressing<C-C>L, which hasa<C-Y> embedded in the map to choose the currently highlighted table in the list.Thereisa special provision whenwriting select statements. Consider thefollowing statement: select * from customer c, contact cn, department as dp, employee e, site_options so where c.In INSERT mode after typing the final "c." whichis an alias for the"customer" table, you can press either<C-C>c or<C-X><C-O>. This willpopupalist of columns for the customer table. It does this by looking backto the beginning of the select statement and findingalist of the tablesspecified in the FROM clause. In thiscaseit notes that in thestring"customerc", "c"is an alias for the customer table. The optional "AS"keywordis also supported, "customer ASc". 4.3.3 Procedure Completion:sql-completion-proceduresSimilar to the table list,<C-C>p, will displayalist of storedprocedures stored within the database. 4.3.4View Completion:sql-completion-viewsSimilar to the table list,<C-C>v, will displayalist of views in thedatabase.4.4 Completion Customizationsql-completion-customization----------------------------The SQL completionplugin can be customized throughvariousoptions set inyourvimrc: omni_sql_no_default_maps- Default: This variableis not defined- If this variableis defined, no maps are created for OMNI completion. Seesql-completion-maps for further discussion. omni_sql_use_tbl_alias- Default:a- This settingis only used when generatinga comma-separated column list.By default the mapis<C-C>l. When generatinga column list, an alias can be prepended to the beginning of each column, for example:e.emp_id, e.emp_name. This option has three settings:n - do not use an aliasd - use the default (calculated) aliasa - ask to confirm the alias name An aliasis determined followinga few rules: 1. If the table name has an '_', then useitasa separator: MY_TABLE_NAME --> MTN my_table_name --> mtn My_table_NAME --> MtN 2. If the table name does NOT contain an '_', but DOES use mixedcase then thecaseis usedasa separator: MyTableName --> MTN 3. If the table name does NOT contain an '_', and does NOT use mixedcase then the firstletter of the tableis used: mytablename --> m MYTABLENAME --> M omni_sql_ignorecase- Default: Current setting for'ignorecase'- Valid settings are0 or 1.- When enteringa few letters before initiating completion, thelist will be filtered to display only the entries which begin with thelist of characters. When this optionis set to 0, thelist will be filtered usingcase sensitivity. omni_sql_include_owner- Default: 0, unless dbext.vim 3.00 has been installed- Valid settings are0 or 1.- When completing tables, procedure or views and using dbext.vim 3.00 or higher thelist ofobjects will also include the owner name. When completing theseobjects and omni_sql_include_owneris enabled the owner name will be replaced. omni_sql_precache_syntax_groups- Default: ['syntax','sqlKeyword','sqlFunction','sqlOption','sqlType','sqlStatement']- sqlcomplete can be used in conjunction with other completion plugins. Thisis outlinedatsql-completion-filetypes. When thefiletypeis changed temporarily to SQL, the sqlcompletionplugin will cache thesyntax groups listed in theList specified in this option.4.5 SQL Mapssql-completion-maps------------The default SQL maps have been described in other sections of this document ingreater detail. Hereisalist of the maps witha brief description of each.Static Maps-----------These are maps which use populate the completionlist using Vim'ssyntaxhighlighting rules. <C-C>a- Displays all SQLsyntax items. <C-C>k- Displays all SQLsyntax items definedas 'sqlKeyword'. <C-C>f- Displays all SQLsyntax items definedas 'sqlFunction. <C-C>o- Displays all SQLsyntax items definedas 'sqlOption'. <C-C>T- Displays all SQLsyntax items definedas 'sqlType'. <C-C>s- Displays all SQLsyntax items definedas 'sqlStatement'.Dynamic Maps------------These are maps which use populate the completionlist using the dbext.vimplugin. <C-C>t- Displaysalist of tables. <C-C>p- Displaysalist of procedures. <C-C>v- Displaysalist of views. <C-C>c- Displaysalist of columns fora specific table. <C-C>l- Displaysa comma-separatedlist of columns fora specific table. <C-C>L- Displaysa comma-separatedlist of columns fora specific table. This should only be used when the completionwindowis active. <Right>- Displaysalist of columns for the table currently highlighted in the completion window.<Right>is not recognized on mostUnix systems, so this mapsis only created on the Windows platform. If you would like the same feature on Unix, choosea different key and make the same map in your vimrc. <Left>- Displays thelist of tables.<Left>is not recognized on mostUnix systems, so this mapsis only created on the Windows platform. If you would like the same feature on Unix, choosea 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 thelist of items.Customizing Maps----------------You can createas many additional key mapsas you like. Generally, the mapswill be specifying differentsyntax highlight groups.If youdo not wish the default maps created or the key choicesdo not work onyour platform (oftenacase on *nix) you define the following variable inyourvimrc: let g:omni_sql_no_default_maps = 1Do not edit ftplugin/sql.vim directly! If you change this file your changeswill be over written on future updates. Vim hasa special directory structurewhich allows you to make customizations withoutchanging the files that areincluded with the Vim distribution. If you wish to customize the mapscreate an after/ftplugin/sql.vim (seeafter-directory) and place the samemaps from the ftplugin/sql.vim init using your own key strokes.<C-C> waschosen sinceit will work on both Windows and *nix platforms. On thewindowsplatform you can also use<C-Space> or ALT keys.4.6 Using with otherfiletypessql-completion-filetypes------------------------------Many times SQL can be used with different filetypes. For example Perl, Java,PHP, Javascript can all interact witha database. Often you need both the SQLcompletion and the completion capabilities for the current language you areediting.This can be enabled easily with the following steps (assumingaPerl file): 1. :e test.pl 2. :set filetype=sql 3. :set ft=perlStep 1------Begins by editingaPerl file. Vim automatically sets thefiletype to"perl". By default, Vim runs the appropriatefiletype fileftplugin/perl.vim. If you are using thesyntax completionplugin by followingthe directionsatft-syntax-omni then the'omnifunc' option has been set to"syntax#Complete". Pressing<C-X><C-O> will display the omnipopup containingthesyntax items for Perl.Step 2------Manually setting thefiletype to'sql' will also fire the appropriatefiletypefiles ftplugin/sql.vim. This file will definea number of buffer specificmaps for SQL completion, seesql-completion-maps. Now these maps havebeen created and the SQL completionplugin has been initialized. All SQLsyntax items have been cached in preparation. The SQLfiletypescript detectswe are attempting to use two different completion plugins. Since the SQL mapsbegin with<C-C>, the maps willtoggle the'omnifunc' when in use. So youcan use<C-X><C-O> to continue using the completion forPerl (using thesyntaxcompletion plugin) and<C-C> to use the SQL completion features.Step 3------Setting thefiletype back toPerl sets all the usual "perl" related items backas they were.vim:tw=78:ts=8:noet:ft=help:norl: