Skip to content

Commit

Permalink
updated for version 7.2a
Browse files Browse the repository at this point in the history
  • Loading branch information
vimboss committed Jun 24, 2008
1 parent 0554c4a commit 97186ba
Show file tree
Hide file tree
Showing 171 changed files with 25,557 additions and 33,232 deletions.
25 changes: 23 additions & 2 deletions runtime/autoload/ccomplete.vim
@@ -1,7 +1,7 @@
" Vim completion script " Vim completion script
" Language: C " Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2006 May 08 " Last Change: 2007 Aug 30




" This function is used for the 'omnifunc' option. " This function is used for the 'omnifunc' option.
Expand Down Expand Up @@ -119,6 +119,27 @@ function! ccomplete#Complete(findstart, base)
" TODO: join previous line if it makes sense " TODO: join previous line if it makes sense
let line = getline('.') let line = getline('.')
let col = col('.') let col = col('.')
if stridx(strpart(line, 0, col), ';') != -1
" Handle multiple declarations on the same line.
let col2 = col - 1
while line[col2] != ';'
let col2 -= 1
endwhile
let line = strpart(line, col2 + 1)
let col -= col2
endif
if stridx(strpart(line, 0, col), ',') != -1
" Handle multiple declarations on the same line in a function
" declaration.
let col2 = col - 1
while line[col2] != ','
let col2 -= 1
endwhile
if strpart(line, col2 + 1, col - col2 - 1) =~ ' *[^ ][^ ]* *[^ ]'
let line = strpart(line, col2 + 1)
let col -= col2
endif
endif
if len(items) == 1 if len(items) == 1
" Completing one word and it's a local variable: May add '[', '.' or " Completing one word and it's a local variable: May add '[', '.' or
" '->'. " '->'.
Expand All @@ -140,7 +161,7 @@ function! ccomplete#Complete(findstart, base)
let res = [{'match': match, 'tagline' : '', 'kind' : kind, 'info' : line}] let res = [{'match': match, 'tagline' : '', 'kind' : kind, 'info' : line}]
else else
" Completing "var.", "var.something", etc. " Completing "var.", "var.something", etc.
let res = s:Nextitem(strpart(line, 0, col), items[1:], 0, 1) let res = s:Nextitem(strpart(line, 0, col), items[-1], 0, 1)
endif endif
endif endif


Expand Down
11 changes: 8 additions & 3 deletions runtime/autoload/spellfile.vim
@@ -1,6 +1,6 @@
" Vim script to download a missing spell file " Vim script to download a missing spell file
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2007 May 08 " Last Change: 2008 May 29


if !exists('g:spellfile_URL') if !exists('g:spellfile_URL')
let g:spellfile_URL = 'ftp://ftp.vim.org/pub/vim/runtime/spell' let g:spellfile_URL = 'ftp://ftp.vim.org/pub/vim/runtime/spell'
Expand Down Expand Up @@ -106,7 +106,12 @@ function! spellfile#LoadFile(lang)
endfor endfor
let dirchoice = confirm(msg, dirchoices) - 2 let dirchoice = confirm(msg, dirchoices) - 2
if dirchoice >= 0 if dirchoice >= 0
exe "write " . escape(dirlist[dirchoice], ' ') . '/' . fname if exists('*fnameescape')
let dirname = fnameescape(dirlist[dirchoice])
else
let dirname = escape(dirlist[dirchoice], ' ')
endif
exe "write " . dirname . '/' . fname


" Also download the .sug file, if the user wants to. " Also download the .sug file, if the user wants to.
let msg = "Do you want me to try getting the .sug file?\n" let msg = "Do you want me to try getting the .sug file?\n"
Expand All @@ -119,7 +124,7 @@ function! spellfile#LoadFile(lang)
call spellfile#Nread(fname) call spellfile#Nread(fname)
if getline(2) =~ 'VIMsug' if getline(2) =~ 'VIMsug'
1d 1d
exe "write " . escape(dirlist[dirchoice], ' ') . '/' . fname exe "write " . dirname . '/' . fname
set nomod set nomod
else else
echo 'Sorry, downloading failed' echo 'Sorry, downloading failed'
Expand Down
72 changes: 37 additions & 35 deletions runtime/autoload/sqlcomplete.vim
@@ -1,8 +1,8 @@
" Vim OMNI completion script for SQL " Vim OMNI completion script for SQL
" Language: SQL " Language: SQL
" Maintainer: David Fishburn <fishburn@ianywhere.com> " Maintainer: David Fishburn <fishburn@ianywhere.com>
" Version: 5.0 " Version: 6.0
" Last Change: Mon Jun 05 2006 3:30:04 PM " Last Change: Thu 03 Apr 2008 10:37:54 PM Eastern Daylight Time
" Usage: For detailed help " Usage: For detailed help
" ":help sql.txt" " ":help sql.txt"
" or ":help ft-sql-omni" " or ":help ft-sql-omni"
Expand Down Expand Up @@ -106,7 +106,7 @@ function! sqlcomplete#Complete(findstart, base)
let begindot = 1 let begindot = 1
endif endif
while start > 0 while start > 0
if line[start - 1] =~ '\w' if line[start - 1] =~ '\(\w\|\s\+\)'
let start -= 1 let start -= 1
elseif line[start - 1] =~ '\.' && elseif line[start - 1] =~ '\.' &&
\ compl_type =~ 'column\|table\|view\|procedure' \ compl_type =~ 'column\|table\|view\|procedure'
Expand Down Expand Up @@ -178,11 +178,10 @@ function! sqlcomplete#Complete(findstart, base)


" Allow the user to override the dbext plugin to specify whether " Allow the user to override the dbext plugin to specify whether
" the owner/creator should be included in the list " the owner/creator should be included in the list
let saved_dbext_show_owner = 1 if g:loaded_dbext >= 300
if exists('g:dbext_default_dict_show_owner') let saveSetting = DB_listOption('dict_show_owner')
let saved_dbext_show_owner = g:dbext_default_dict_show_owner exec 'DBSetOption dict_show_owner='.(g:omni_sql_include_owner==1?'1':'0')
endif endif
let g:dbext_default_dict_show_owner = g:omni_sql_include_owner


let compl_type_uc = substitute(compl_type, '\w\+', '\u&', '') let compl_type_uc = substitute(compl_type, '\w\+', '\u&', '')
if s:sql_file_{compl_type} == "" if s:sql_file_{compl_type} == ""
Expand All @@ -192,18 +191,12 @@ function! sqlcomplete#Complete(findstart, base)
if s:sql_file_{compl_type} != "" if s:sql_file_{compl_type} != ""
if filereadable(s:sql_file_{compl_type}) if filereadable(s:sql_file_{compl_type})
let compl_list = readfile(s:sql_file_{compl_type}) let compl_list = readfile(s:sql_file_{compl_type})
" let dic_list = readfile(s:sql_file_{compl_type})
" if !empty(dic_list)
" for elem in dic_list
" let kind = (compl_type=='table'?'m':(compl_type=='procedure'?'f':'v'))
" let item = {'word':elem, 'menu':elem, 'kind':kind, 'info':compl_type}
" let compl_list += [item]
" endfor
" endif
endif endif
endif endif


let g:dbext_default_dict_show_owner = saved_dbext_show_owner if g:loaded_dbext > 300
exec 'DBSetOption dict_show_owner='.saveSetting
endif
elseif compl_type =~? 'column' elseif compl_type =~? 'column'


" This type of completion relies upon the dbext.vim plugin " This type of completion relies upon the dbext.vim plugin
Expand Down Expand Up @@ -450,8 +443,8 @@ function! s:SQLCCheck4dbext()
" Leave time for the user to read the error message " Leave time for the user to read the error message
:sleep 2 :sleep 2
return -1 return -1
elseif g:loaded_dbext < 300 elseif g:loaded_dbext < 600
let msg = "The dbext plugin must be at least version 3.00 " . let msg = "The dbext plugin must be at least version 5.30 " .
\ " for dynamic SQL completion" \ " for dynamic SQL completion"
call s:SQLCErrorMsg(msg) call s:SQLCErrorMsg(msg)
" Leave time for the user to read the error message " Leave time for the user to read the error message
Expand Down Expand Up @@ -514,46 +507,54 @@ endfunction
function! s:SQLCGetObjectOwner(object) function! s:SQLCGetObjectOwner(object)
" The owner regex matches a word at the start of the string which is " The owner regex matches a word at the start of the string which is
" followed by a dot, but doesn't include the dot in the result. " followed by a dot, but doesn't include the dot in the result.
" ^ - from beginning of line " ^ - from beginning of line
" "\? - ignore any quotes " \("\|\[\)\? - ignore any quotes
" \zs - start the match now " \zs - start the match now
" \w\+ - get owner name " .\{-} - get owner name
" \ze - end the match " \ze - end the match
" "\? - ignore any quotes " \("\|\[\)\? - ignore any quotes
" \. - must by followed by a . " \. - must by followed by a .
let owner = matchstr( a:object, '^"\?\zs\w\+\ze"\?\.' ) " let owner = matchstr( a:object, '^\s*\zs.*\ze\.' )
let owner = matchstr( a:object, '^\("\|\[\)\?\zs\.\{-}\ze\("\|\]\)\?\.' )
return owner return owner
endfunction endfunction


function! s:SQLCGetColumns(table_name, list_type) function! s:SQLCGetColumns(table_name, list_type)
" Check if the table name was provided as part of the column name " Check if the table name was provided as part of the column name
let table_name = matchstr(a:table_name, '^[a-zA-Z0-9_]\+\ze\.\?') let table_name = matchstr(a:table_name, '^["\[\]a-zA-Z0-9_ ]\+\ze\.\?')
let table_cols = [] let table_cols = []
let table_alias = '' let table_alias = ''
let move_to_top = 1 let move_to_top = 1


let table_name = substitute(table_name, '\s*\(.\{-}\)\s*$', '\1', 'g')

" If the table name was given as:
" where c.
let table_name = substitute(table_name, '^\c\(WHERE\|AND\|OR\)\s\+', '', '')
if g:loaded_dbext >= 300 if g:loaded_dbext >= 300
let saveSettingAlias = DB_listOption('use_tbl_alias') let saveSettingAlias = DB_listOption('use_tbl_alias')
exec 'DBSetOption use_tbl_alias=n' exec 'DBSetOption use_tbl_alias=n'
endif endif


let table_name_stripped = substitute(table_name, '["\[\]]*', '', 'g')

" Check if we have already cached the column list for this table " Check if we have already cached the column list for this table
" by its name " by its name
let list_idx = index(s:tbl_name, table_name, 0, &ignorecase) let list_idx = index(s:tbl_name, table_name_stripped, 0, &ignorecase)
if list_idx > -1 if list_idx > -1
let table_cols = split(s:tbl_cols[list_idx]) let table_cols = split(s:tbl_cols[list_idx], '\n')
else else
" Check if we have already cached the column list for this table " Check if we have already cached the column list for this table
" by its alias, assuming the table_name provided was actually " by its alias, assuming the table_name provided was actually
" the alias for the table instead " the alias for the table instead
" select * " select *
" from area a " from area a
" where a. " where a.
let list_idx = index(s:tbl_alias, table_name, 0, &ignorecase) let list_idx = index(s:tbl_alias, table_name_stripped, 0, &ignorecase)
if list_idx > -1 if list_idx > -1
let table_alias = table_name let table_alias = table_name_stripped
let table_name = s:tbl_name[list_idx] let table_name = s:tbl_name[list_idx]
let table_cols = split(s:tbl_cols[list_idx]) let table_cols = split(s:tbl_cols[list_idx], '\n')
endif endif
endif endif


Expand Down Expand Up @@ -609,15 +610,16 @@ function! s:SQLCGetColumns(table_name, list_type)
" '.*' - Exclude the rest of the line in the match " '.*' - Exclude the rest of the line in the match
let table_name_new = matchstr(@y, let table_name_new = matchstr(@y,
\ 'from.\{-}'. \ 'from.\{-}'.
\ '\zs\(\(\<\w\+\>\)\.\)\?'. \ '\zs\(\("\|\[\)\?.\{-}\("\|\]\)\.\)\?'.
\ '\<\w\+\>\ze'. \ '\("\|\[\)\?.\{-}\("\|\]\)\ze'.
\ '\s\+\%(as\s\+\)\?\<'. \ '\s\+\%(as\s\+\)\?\<'.
\ matchstr(table_name, '.\{-}\ze\.\?$'). \ matchstr(table_name, '.\{-}\ze\.\?$').
\ '\>'. \ '\>'.
\ '\s*\.\@!.*'. \ '\s*\.\@!.*'.
\ '\(\<where\>\|$\)'. \ '\(\<where\>\|$\)'.
\ '.*' \ '.*'
\ ) \ )

if table_name_new != '' if table_name_new != ''
let table_alias = table_name let table_alias = table_name
let table_name = table_name_new let table_name = table_name_new
Expand Down Expand Up @@ -668,7 +670,7 @@ function! s:SQLCGetColumns(table_name, list_type)
let s:tbl_name = add( s:tbl_name, table_name ) let s:tbl_name = add( s:tbl_name, table_name )
let s:tbl_alias = add( s:tbl_alias, table_alias ) let s:tbl_alias = add( s:tbl_alias, table_alias )
let s:tbl_cols = add( s:tbl_cols, table_cols_str ) let s:tbl_cols = add( s:tbl_cols, table_cols_str )
let table_cols = split(table_cols_str) let table_cols = split(table_cols_str, '\n')
endif endif


endif endif
Expand Down

0 comments on commit 97186ba

Please sign in to comment.