updated for version 7.0e06
diff --git a/runtime/autoload/rubycomplete.vim b/runtime/autoload/rubycomplete.vim
index 0a745b9..d1c8a26 100644
--- a/runtime/autoload/rubycomplete.vim
+++ b/runtime/autoload/rubycomplete.vim
@@ -10,6 +10,7 @@
 " Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com)
 " ----------------------------------------------------------------------------
 
+" {{{ requirement checks
 if !has('ruby')
     echohl ErrorMsg
     echo "Error: Required vim compiled with +ruby"
@@ -23,8 +24,17 @@
     echohl None
     finish
 endif
+" }}} requirement checks
 
+if !exists("g:rubycomplete_rails")
+    let g:rubycomplete_rails = 0
+endif
 
+if !exists("g:rubycomplete_classes_in_global")
+    let g:rubycomplete_classes_in_global = 0
+endif
+
+" {{{ vim-side support functions
 function! GetBufferRubyModule(name)
     let [snum,enum] = GetBufferRubyEntity(a:name, "module")
     return snum . '..' . enum
@@ -103,6 +113,8 @@
     return ''
 endfunction
 
+"}}} vim-side support functions
+
 function! rubycomplete#Complete(findstart, base)
      "findstart = 1 when we need to get the text length
     if a:findstart
@@ -133,6 +145,7 @@
 
 function! s:DefRuby()
 ruby << RUBYEOF
+# {{{ ruby completion
 RailsWords = [
       "has_many", "has_one",
       "belongs_to",
@@ -164,11 +177,11 @@
 
 
 def load_requires
-  @buf = VIM::Buffer.current
-  enum = @buf.line_number
+  buf = VIM::Buffer.current
+  enum = buf.line_number
   nums = Range.new( 1, enum )
   nums.each do |x|
-    ln = @buf[x]
+    ln = buf[x]
     begin
       eval( "require %s" % $1 ) if /.*require\s*(.*)$/.match( ln )
     rescue Exception
@@ -198,7 +211,7 @@
 end
 
 def get_buffer_entity(name, vimfun)
-  @buf = VIM::Buffer.current
+  buf = VIM::Buffer.current
   nums = eval( VIM::evaluate( vimfun % name ) )
   return nil if nums == nil 
   return nil if nums.min == nums.max && nums.min == 0
@@ -207,7 +220,7 @@
   classdef = ""
   nums.each do |x|
     if x != cur_line
-      ln = @buf[x] 
+      ln = buf[x] 
       classdef += "%s\n" % ln
     end
   end
@@ -215,6 +228,25 @@
   return classdef
 end
 
+def get_buffer_classes()
+  # this will be a little expensive.
+  allow_aggressive_load = VIM::evaluate('g:rubycomplete_classes_in_global')
+  return [] if allow_aggressive_load != '1'
+
+  buf = VIM::Buffer.current
+  eob = buf.length
+  ret = []
+  rg = 1..eob
+
+  rg.each do |x|
+    if /^\s*class\s*([A-Za-z0-9_-]*)(\s*<\s*([A-Za-z0-9_:-]*))?\s*/.match( buf[x] )
+      ret.push $1  
+    end
+  end
+
+  return ret
+end
+
 def load_rails()
   allow_rails = VIM::evaluate('g:rubycomplete_rails')
   return if allow_rails != '1'
@@ -233,13 +265,19 @@
         break
     end
   end
+  
+  return if pok == nil
   bootfile = pok + "/boot.rb"
-  require bootfile if pok != nil && File.exists?( bootfile )
+  if File.exists?( bootfile )
+    require bootfile 
+    VIM::evaluate('let g:rubycomplete_rails_loaded = 1') 
+  end
 end
 
 def get_rails_helpers
   allow_rails = VIM::evaluate('g:rubycomplete_rails')
-  return [] if allow_rails != '1'
+  rails_loaded = VIM::evaluate('g:rubycomplete_rails_loaded')
+  return [] if allow_rails != '1' || rails_loaded != '1'
   return RailsWords 
 end
 
@@ -404,14 +442,21 @@
         receiver = $1
         message = input
         load_buffer_class( receiver )
-        candidates = eval( "#{receiver}.instance_methods" )
-        candidates += get_rails_helpers
-        select_message(receiver, message, candidates)
+        begin
+          candidates = eval( "#{receiver}.instance_methods" )
+          candidates += get_rails_helpers
+          select_message(receiver, message, candidates)
+        rescue Exception
+          found = nil
+        end
       end
     end
     
     if inclass == nil || found == nil
       candidates = eval("self.class.constants")
+      candidates += get_buffer_classes
+      candidates.uniq!
+      candidates.sort!
       (candidates|ReservedWords).grep(/^#{Regexp.quote(input)}/)
     end
   end
@@ -459,10 +504,12 @@
   candidates.uniq!
   candidates.sort!
 end
+
+# }}} ruby completion
 RUBYEOF
 endfunction
 
+let g:rubycomplete_rails_loaded = 0
 
-let g:rubycomplete_rails = 0
 call s:DefRuby()
-" vim: set et ts=4:
+" vim:tw=78:sw=4:ts=8:ft=vim:norl:
diff --git a/runtime/autoload/sqlcomplete.vim b/runtime/autoload/sqlcomplete.vim
index b0415bc..ec158f6 100644
--- a/runtime/autoload/sqlcomplete.vim
+++ b/runtime/autoload/sqlcomplete.vim
@@ -1,8 +1,8 @@
 " Vim completion script
 " Language:    SQL
 " Maintainer:  David Fishburn <fishburn@ianywhere.com>
-" Version:     2.0
-" Last Change: Mon Apr 03 2006 10:21:36 PM
+" Version:     3.0
+" Last Change: Thu Apr 20 2006 8:47:12 PM
 
 " Set completion with CTRL-X CTRL-O to autoloaded function.
 " This check is in place in case this script is
@@ -18,7 +18,7 @@
 if exists('g:loaded_sql_completion')
     finish 
 endif
-let g:loaded_sql_completion = 1
+let g:loaded_sql_completion = 30
 
 " Maintains filename of dictionary
 let s:sql_file_table        = ""
@@ -60,6 +60,24 @@
                 \ 'sqlStatement'
                 \ ]
 endif
+" Set ignorecase to the ftplugin standard
+if !exists('g:omni_sql_ignorecase')
+    let g:omni_sql_ignorecase = &ignorecase
+endif
+" During table completion, should the table list also
+" include the owner name
+if !exists('g:omni_sql_include_owner')
+    let g:omni_sql_include_owner = 0
+    if exists('g:loaded_dbext')
+        if g:loaded_dbext >= 300
+            " New to dbext 3.00, by default the table lists include the owner
+            " name of the table.  This is used when determining how much of
+            " whatever has been typed should be replaced as part of the 
+            " code replacement.
+            let g:omni_sql_include_owner = 1
+        endif
+    endif
+endif
 
 " This function is used for the 'omnifunc' option.
 function! sqlcomplete#Complete(findstart, base)
@@ -81,15 +99,27 @@
         while start > 0
             if line[start - 1] =~ '\w'
                 let start -= 1
-            elseif line[start - 1] =~ '\.' && compl_type =~ 'column'
-                " If the completion type is column then assume we are looking
-                " for column completion column_type can be either 
-                " 'column' or 'column_csv'
-                if lastword == -1 && compl_type == 'column'
-                    " Do not replace the table name prefix or alias
-                    " if completing only a single column name
+            elseif line[start - 1] =~ '\.' && 
+                        \ compl_type =~ 'column\|table\|view\|procedure'
+                " If lastword has already been set for column completion
+                " break from the loop, since we do not also want to pickup
+                " a table name if it was also supplied.
+                if lastword != -1 && compl_type =~ 'column'
+                    break
+                endif
+                " Assume we are looking for column completion
+                " column_type can be either 'column' or 'column_csv'
+                if lastword == -1 && compl_type =~ 'column'
                     let lastword = start
                 endif
+                " If omni_sql_include_owner = 0, do not include the table
+                " name as part of the substitution, so break here
+                if lastword == -1 && 
+                            \ compl_type =~ 'table\|view\|procedure' && 
+                            \ g:omni_sql_include_owner == 0
+                    let lastword = start
+                    break
+                endif
                 let start -= 1
             else
                 break
@@ -144,6 +174,14 @@
         if s:sql_file_{compl_type} != ""
             if filereadable(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
     elseif compl_type == 'column'
@@ -203,8 +241,8 @@
     if base != ''
         " Filter the list based on the first few characters the user
         " entered
-        let expr = 'v:val =~ "^'.base.'"'
-        let compl_list = filter(copy(compl_list), expr)
+        let expr = 'v:val '.(g:omni_sql_ignorecase==1?'=~?':'=~#').' "^'.base.'"'
+        let compl_list = filter(deepcopy(compl_list), expr)
     endif
 
     if exists('b:sql_compl_savefunc') && b:sql_compl_savefunc != ""
@@ -297,8 +335,8 @@
         " Leave time for the user to read the error message
         :sleep 2
         return -1
-    elseif g:loaded_dbext < 210
-        let msg = "The dbext plugin must be at least version 2.10 " .
+    elseif g:loaded_dbext < 300
+        let msg = "The dbext plugin must be at least version 3.00 " .
                     \ " for dynamic SQL completion"
         call s:SQLCErrorMsg(msg)
         " Leave time for the user to read the error message
@@ -363,7 +401,7 @@
     let table_alias  = ''
     let move_to_top  = 1
 
-    if g:loaded_dbext >= 210
+    if g:loaded_dbext >= 300
         let saveSettingAlias = DB_listOption('use_tbl_alias')
         exec 'DBSetOption use_tbl_alias=n'
     endif
@@ -479,7 +517,7 @@
          call cursor(curline, curcol)
          
          if found == 0
-             if g:loaded_dbext > 201
+             if g:loaded_dbext > 300
                  exec 'DBSetOption use_tbl_alias='.saveSettingAlias
              endif
 
@@ -502,7 +540,7 @@
 
     endif
 
-    if g:loaded_dbext > 201
+    if g:loaded_dbext > 300
         exec 'DBSetOption use_tbl_alias='.saveSettingAlias
     endif