From f193fffd16563cfbe7c02a21e19c8bb11707581d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 27 Apr 2006 00:02:13 +0000 Subject: updated for version 7.0f02 --- runtime/ftplugin/sql.vim | 51 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 17 deletions(-) (limited to 'runtime/ftplugin/sql.vim') diff --git a/runtime/ftplugin/sql.vim b/runtime/ftplugin/sql.vim index 1bc58318c..c9924b73d 100644 --- a/runtime/ftplugin/sql.vim +++ b/runtime/ftplugin/sql.vim @@ -1,8 +1,8 @@ " SQL filetype plugin file " Language: SQL (Common for Oracle, Microsoft SQL Server, Sybase) -" Version: 1.0 +" Version: 3.0 " Maintainer: David Fishburn -" Last Change: Tue Mar 28 2006 2:26:48 PM +" Last Change: Wed Apr 26 2006 3:02:32 PM " Download: http://vim.sourceforge.net/script.php?script_id=454 " For more details please use: @@ -360,6 +360,11 @@ setlocal comments=s1:/*,mb:*,ex:*/,:--,:// " Set completion with CTRL-X CTRL-O to autoloaded function. if exists('&omnifunc') + " Since the SQL completion plugin can be used in conjunction + " with other completion filetypes it must record the previous + " OMNI function prior to setting up the SQL OMNI function + let b:sql_compl_savefunc = &omnifunc + " This is used by the sqlcomplete.vim plugin " Source it for it's global functions runtime autoload/syntaxcomplete.vim @@ -370,28 +375,40 @@ if exists('&omnifunc') if !exists('g:omni_sql_no_default_maps') " Static maps which use populate the completion list " using Vim's syntax highlighting rules - imap a :let b:sql_compl_type='syntax' - imap k :let b:sql_compl_type='sqlKeyword' - imap f :let b:sql_compl_type='sqlFunction' - imap o :let b:sql_compl_type='sqlOption' - imap T :let b:sql_compl_type='sqlType' - imap s :let b:sql_compl_type='sqlStatement' + imap a :call sqlcomplete#Map('syntax') + imap k :call sqlcomplete#Map('sqlKeyword') + imap f :call sqlcomplete#Map('sqlFunction') + imap o :call sqlcomplete#Map('sqlOption') + imap T :call sqlcomplete#Map('sqlType') + imap s :call sqlcomplete#Map('sqlStatement') " Dynamic maps which use populate the completion list " using the dbext.vim plugin - imap t :let b:sql_compl_type='table' - imap p :let b:sql_compl_type='procedure' - imap v :let b:sql_compl_type='view' - imap c :let b:sql_compl_type='column' - imap l :let b:sql_compl_type='column_csv' + imap t :call sqlcomplete#Map('table') + imap p :call sqlcomplete#Map('procedure') + imap v :call sqlcomplete#Map('view') + imap c :call sqlcomplete#Map('column') + imap l :call sqlcomplete#Map('column_csv') " The next 3 maps are only to be used while the completion window is " active due to the at the beginning of the map - imap L :let b:sql_compl_type='column_csv' + imap L :call sqlcomplete#Map('column_csv') + " is not recognized on most Unix systems, so only create + " these additional maps on the Windows platform. + " If you would like to use these maps, choose a different key and make + " the same map in your vimrc. if has('win32') - imap :let b:sql_compl_type='column' - imap :let b:sql_compl_type='tableReset' + imap =sqlcomplete#DrillIntoTable() + imap =sqlcomplete#DrillOutOfColumns() endif " Remove any cached items useful for schema changes - imap R :let b:sql_compl_type='resetCache' + imap R :call sqlcomplete#Map('resetCache') + endif + + if b:sql_compl_savefunc != "" + " We are changing the filetype to SQL from some other filetype + " which had OMNI completion defined. We need to activate the + " SQL completion plugin in order to cache some of the syntax items + " while the syntax rules for SQL are active. + call sqlcomplete#PreCacheSyntax() endif endif -- cgit v1.2.1