1
0
forked from aniani/vim

Runtime file updates.

This commit is contained in:
Bram Moolenaar 2010-08-01 16:13:51 +02:00
parent 7e88c3dc19
commit f9d5ca1de4
4 changed files with 89 additions and 14 deletions

View File

@ -1,25 +1,44 @@
" Vim OMNI completion script for SQL " Vim OMNI completion script for SQL
" Language: SQL " Language: SQL
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
" Version: 9.0 " Version: 10.0
" Last Change: 2010 Apr 20 " Last Change: 2010 Jun 11
" Usage: For detailed help " Usage: For detailed help
" ":help sql.txt" " ":help sql.txt"
" or ":help ft-sql-omni" " or ":help ft-sql-omni"
" or read $VIMRUNTIME/doc/sql.txt " or read $VIMRUNTIME/doc/sql.txt
" History " 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 " Version 9.0
" This change removes some of the support for tables with spaces in their " 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 " names in order to simplify the regexes used to pull out query table
" aliases for more robust table name and column name code completion. " aliases for more robust table name and column name code completion.
" Full support for "table names with spaces" can be added in again " Full support for "table names with spaces" can be added in again
" after 7.3. " after 7.3.
"
" Version 8.0 " Version 8.0
" Incorrectly re-executed the g:ftplugin_sql_omni_key_right and g:ftplugin_sql_omni_key_left " 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. " when drilling in and out of a column list for a table.
"
" Version 7.0 " Version 7.0
" Better handling of object names " Better handling of object names
"
" Version 6.0 " Version 6.0
" Supports object names with spaces "my table name" " Supports object names with spaces "my table name"
" "
@ -37,7 +56,7 @@ endif
if exists('g:loaded_sql_completion') if exists('g:loaded_sql_completion')
finish finish
endif endif
let g:loaded_sql_completion = 70 let g:loaded_sql_completion = 100
" Maintains filename of dictionary " Maintains filename of dictionary
let s:sql_file_table = "" let s:sql_file_table = ""
@ -363,7 +382,13 @@ endfunc
function! sqlcomplete#PreCacheSyntax(...) function! sqlcomplete#PreCacheSyntax(...)
let syn_group_arr = [] let syn_group_arr = []
let syn_items = []
if a:0 > 0 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 let syn_group_arr = a:1
else else
let syn_group_arr = g:omni_sql_precache_syntax_groups let syn_group_arr = g:omni_sql_precache_syntax_groups
@ -372,7 +397,36 @@ function! sqlcomplete#PreCacheSyntax(...)
" the sytnax items. " the sytnax items.
if !empty(syn_group_arr) if !empty(syn_group_arr)
for group_name in 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 endfor
endif endif
endfunction endfunction
@ -430,13 +484,13 @@ endfunction
function! s:SQLCWarningMsg(msg) function! s:SQLCWarningMsg(msg)
echohl WarningMsg echohl WarningMsg
echomsg a:msg echomsg 'SQLComplete:'.a:msg
echohl None echohl None
endfunction endfunction
function! s:SQLCErrorMsg(msg) function! s:SQLCErrorMsg(msg)
echohl ErrorMsg echohl ErrorMsg
echomsg a:msg echomsg 'SQLComplete:'.a:msg
echohl None echohl None
endfunction endfunction
@ -462,7 +516,7 @@ function! s:SQLCGetSyntaxList(syn_group)
let g:omni_syntax_group_include_sql = syn_group let g:omni_syntax_group_include_sql = syn_group
endif endif
let g:omni_syntax_group_exclude_sql = '' 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_include_sql = s:save_inc
let g:omni_syntax_group_exclude_sql = s:save_exc let g:omni_syntax_group_exclude_sql = s:save_exc
" Cache these values for later use " Cache these values for later use

View File

@ -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 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:$") 'listchars' 'lcs' string (default "eol:$")
global global
{not in Vi} {not in Vi}
Strings to use in 'list' mode. It is a comma separated list of string Strings to use in 'list' mode and for the |:list| command. It is a
settings. comma separated list of string settings.
eol:c Character to show at the end of each line. When eol:c Character to show at the end of each line. When
omitted, there is no extra character at the end of the omitted, there is no extra character at the end of the
line. line.

View File

@ -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 VIM REFERENCE MANUAL by Bram Moolenaar
@ -106,7 +106,8 @@ g8 Print the hex values of the bytes used in the
*:l* *:list* *:l* *:list*
:[range]l[ist] [count] [flags] :[range]l[ist] [count] [flags]
Same as :print, but display unprintable characters 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]. See |ex-flags| for [flags].
*:nu* *:number* *:nu* *:number*

View File

@ -1,8 +1,8 @@
" SQL filetype plugin file " SQL filetype plugin file
" Language: SQL (Common for Oracle, Microsoft SQL Server, Sybase) " Language: SQL (Common for Oracle, Microsoft SQL Server, Sybase)
" Version: 6.0 " Version: 7.0
" Maintainer: David Fishburn <fishburn at ianywhere dot com> " 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 " Download: http://vim.sourceforge.net/script.php?script_id=454
" For more details please use: " For more details please use:
@ -36,6 +36,11 @@
" "
" History " History
" "
" Version 7.0
"
" NF: Calls the sqlcomplete#ResetCacheSyntax() function when calling
" SQLSetType.
"
" Version 6.0 " Version 6.0
" "
" NF: Adds the command SQLGetType " NF: Adds the command SQLGetType
@ -164,12 +169,26 @@ if !exists("*SQL_SetType")
endif endif
let b:sql_type_override = new_sql_type 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 " Vim will automatically source the correct files if we
" change the filetype. You cannot do this with setfiletype " change the filetype. You cannot do this with setfiletype
" since that command will only execute if a filetype has " since that command will only execute if a filetype has
" not already been set. In this case we want to override " not already been set. In this case we want to override
" the existing filetype. " the existing filetype.
let &filetype = 'sql' 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 endfunction
command! -nargs=* -complete=custom,SQL_GetList SQLSetType :call SQL_SetType(<q-args>) 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 " which had OMNI completion defined. We need to activate the
" SQL completion plugin in order to cache some of the syntax items " SQL completion plugin in order to cache some of the syntax items
" while the syntax rules for SQL are active. " while the syntax rules for SQL are active.
call sqlcomplete#ResetCacheSyntax()
call sqlcomplete#PreCacheSyntax() call sqlcomplete#PreCacheSyntax()
endif endif
endif endif