diff options
author | Bram Moolenaar <Bram@vim.org> | 2010-08-01 16:13:51 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2010-08-01 16:13:51 +0200 |
commit | f9d5ca1de458c63711f7b361694e02ab0bee0cff (patch) | |
tree | e9c56f246b08c606021553cec39c3069bd9735f6 | |
parent | 7e88c3dc1987c9e2ae7d626c277add7ec7c6d401 (diff) | |
download | vim-f9d5ca1de458c63711f7b361694e02ab0bee0cff.zip |
Runtime file updates.
-rw-r--r-- | runtime/autoload/sqlcomplete.vim | 68 | ||||
-rw-r--r-- | runtime/doc/options.txt | 6 | ||||
-rw-r--r-- | runtime/doc/various.txt | 5 | ||||
-rw-r--r-- | runtime/ftplugin/sql.vim | 24 |
4 files changed, 89 insertions, 14 deletions
diff --git a/runtime/autoload/sqlcomplete.vim b/runtime/autoload/sqlcomplete.vim index 2d88862a1..5599c0d03 100644 --- a/runtime/autoload/sqlcomplete.vim +++ b/runtime/autoload/sqlcomplete.vim @@ -1,25 +1,44 @@ " Vim OMNI completion script for SQL " Language: SQL " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> -" Version: 9.0 -" Last Change: 2010 Apr 20 +" Version: 10.0 +" Last Change: 2010 Jun 11 " Usage: For detailed help " ":help sql.txt" " or ":help ft-sql-omni" " or read $VIMRUNTIME/doc/sql.txt " History +" Version 10.0 +" Updated PreCacheSyntax() +" - Now returns a List of the syntax items it finds. +" This allows other plugins / scripts to use this list for their own +" purposes. In this case XPTemplate can use them for a Choose list. +" - Verifies the parameters are the correct type and displays a +" warning if not. +" - Verifies the parameters are the correct type and displays a +" warning if not. +" Updated SQLCWarningMsg() +" - Prepends warning message with SQLComplete so you know who issued +" the warning. +" Updated SQLCErrorMsg() +" - Prepends error message with SQLComplete so you know who issued +" the error. +" " Version 9.0 " This change removes some of the support for tables with spaces in their " names in order to simplify the regexes used to pull out query table " aliases for more robust table name and column name code completion. " Full support for "table names with spaces" can be added in again " after 7.3. +" " Version 8.0 " Incorrectly re-executed the g:ftplugin_sql_omni_key_right and g:ftplugin_sql_omni_key_left " when drilling in and out of a column list for a table. +" " Version 7.0 " Better handling of object names +" " Version 6.0 " Supports object names with spaces "my table name" " @@ -37,7 +56,7 @@ endif if exists('g:loaded_sql_completion') finish endif -let g:loaded_sql_completion = 70 +let g:loaded_sql_completion = 100 " Maintains filename of dictionary let s:sql_file_table = "" @@ -363,7 +382,13 @@ endfunc function! sqlcomplete#PreCacheSyntax(...) let syn_group_arr = [] + let syn_items = [] + if a:0 > 0 + if type(a:1) != 3 + call s:SQLCWarningMsg("Parameter is not a list. Example:['syntaxGroup1', 'syntaxGroup2']") + return '' + endif let syn_group_arr = a:1 else let syn_group_arr = g:omni_sql_precache_syntax_groups @@ -372,7 +397,36 @@ function! sqlcomplete#PreCacheSyntax(...) " the sytnax items. if !empty(syn_group_arr) for group_name in syn_group_arr - call s:SQLCGetSyntaxList(group_name) + let syn_items = extend( syn_items, s:SQLCGetSyntaxList(group_name) ) + endfor + endif + + return syn_items +endfunction + +function! sqlcomplete#ResetCacheSyntax(...) + let syn_group_arr = [] + + if a:0 > 0 + if type(a:1) != 3 + call s:SQLCWarningMsg("Parameter is not a list. Example:['syntaxGroup1', 'syntaxGroup2']") + return '' + endif + let syn_group_arr = a:1 + else + let syn_group_arr = g:omni_sql_precache_syntax_groups + endif + " For each group specified in the list, precache all + " the sytnax items. + if !empty(syn_group_arr) + for group_name in syn_group_arr + let list_idx = index(s:syn_list, group_name, 0, &ignorecase) + if list_idx > -1 + " Remove from list of groups + call remove( s:syn_list, list_idx ) + " Remove from list of keywords + call remove( s:syn_value, list_idx ) + endif endfor endif endfunction @@ -430,13 +484,13 @@ endfunction function! s:SQLCWarningMsg(msg) echohl WarningMsg - echomsg a:msg + echomsg 'SQLComplete:'.a:msg echohl None endfunction function! s:SQLCErrorMsg(msg) echohl ErrorMsg - echomsg a:msg + echomsg 'SQLComplete:'.a:msg echohl None endfunction @@ -462,7 +516,7 @@ function! s:SQLCGetSyntaxList(syn_group) let g:omni_syntax_group_include_sql = syn_group endif let g:omni_syntax_group_exclude_sql = '' - let syn_value = OmniSyntaxList() + let syn_value = syntaxcomplete#OmniSyntaxList() let g:omni_syntax_group_include_sql = s:save_inc let g:omni_syntax_group_exclude_sql = s:save_exc " Cache these values for later use diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 469d6064c..e88dc04fe 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.3c. Last change: 2010 Jul 28 +*options.txt* For Vim version 7.3c. Last change: 2010 Aug 01 VIM REFERENCE MANUAL by Bram Moolenaar @@ -4490,8 +4490,8 @@ A jump table for the options with a short description can be found at |Q_op|. 'listchars' 'lcs' string (default "eol:$") global {not in Vi} - Strings to use in 'list' mode. It is a comma separated list of string - settings. + Strings to use in 'list' mode and for the |:list| command. It is a + comma separated list of string settings. eol:c Character to show at the end of each line. When omitted, there is no extra character at the end of the line. diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index b2d53c89a..b2945e064 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -1,4 +1,4 @@ -*various.txt* For Vim version 7.3c. Last change: 2010 Jul 24 +*various.txt* For Vim version 7.3c. Last change: 2010 Aug 01 VIM REFERENCE MANUAL by Bram Moolenaar @@ -106,7 +106,8 @@ g8 Print the hex values of the bytes used in the *:l* *:list* :[range]l[ist] [count] [flags] Same as :print, but display unprintable characters - with '^' and put $ after the line. + with '^' and put $ after the line. This can be + changed with the 'listchars' option. See |ex-flags| for [flags]. *:nu* *:number* diff --git a/runtime/ftplugin/sql.vim b/runtime/ftplugin/sql.vim index f41fb5b20..cbc8dcc9a 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: 6.0 +" Version: 7.0 " Maintainer: David Fishburn <fishburn at ianywhere dot com> -" Last Change: 2009 Aug 04 +" Last Change: 2010 Jun 11 " Download: http://vim.sourceforge.net/script.php?script_id=454 " For more details please use: @@ -36,6 +36,11 @@ " " History " +" Version 7.0 +" +" NF: Calls the sqlcomplete#ResetCacheSyntax() function when calling +" SQLSetType. +" " Version 6.0 " " NF: Adds the command SQLGetType @@ -164,12 +169,26 @@ if !exists("*SQL_SetType") endif let b:sql_type_override = new_sql_type + " Remove any cached SQL since a new sytax will have different + " items and groups + if !exists('g:loaded_sql_completion') || 100 == g:loaded_sql_completion + call sqlcomplete#ResetCacheSyntax() + endif + " Vim will automatically source the correct files if we " change the filetype. You cannot do this with setfiletype " since that command will only execute if a filetype has " not already been set. In this case we want to override " the existing filetype. let &filetype = 'sql' + + 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 endfunction command! -nargs=* -complete=custom,SQL_GetList SQLSetType :call SQL_SetType(<q-args>) @@ -463,6 +482,7 @@ if exists('&omnifunc') " 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#ResetCacheSyntax() call sqlcomplete#PreCacheSyntax() endif endif |