diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-04-22 22:33:57 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-04-22 22:33:57 +0000 |
commit | eb3593b38b7b6b658e93ad05d6caf76d58cc0c35 (patch) | |
tree | 39210f19a86e4db2914523b0fde4a5ff9d345c16 | |
parent | 57657d85c6c3d812e99b5e5d5161c07c66ac7dc7 (diff) |
updated for version 7.0e06v7.0e06
49 files changed, 729 insertions, 365 deletions
diff --git a/runtime/autoload/rubycomplete.vim b/runtime/autoload/rubycomplete.vim index 0a745b98c9..d1c8a26538 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 @@ if version < 700 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 @@ function! GetRubyVarType(v) 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 @@ endfunction function! s:DefRuby() ruby << RUBYEOF +# {{{ ruby completion RailsWords = [ "has_many", "has_one", "belongs_to", @@ -164,11 +177,11 @@ Operators = [ "%", "&", "*", "**", "+", "-", "/", 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 @@ def load_buffer_module(name) 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 @@ def get_buffer_entity(name, vimfun) 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 @@ def get_buffer_entity(name, vimfun) 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 @@ def load_rails() 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 @@ def get_completions(base) 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 @@ def select_message(receiver, message, candidates) 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 b0415bc152..ec158f6832 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 @@ endif 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 @@ if !exists('g:omni_sql_precache_syntax_groups') \ '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,14 +99,26 @@ function! sqlcomplete#Complete(findstart, base) 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 @@ -144,6 +174,14 @@ function! sqlcomplete#Complete(findstart, base) 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 @@ function! sqlcomplete#Complete(findstart, base) 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 @@ function! s:SQLCCheck4dbext() " 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 @@ function! s:SQLCGetColumns(table_name, list_type) 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 @@ function! s:SQLCGetColumns(table_name, list_type) 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 @@ function! s:SQLCGetColumns(table_name, list_type) endif - if g:loaded_dbext > 201 + if g:loaded_dbext > 300 exec 'DBSetOption use_tbl_alias='.saveSettingAlias endif diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt index 8555788520..ac807a40cd 100644 --- a/runtime/doc/motion.txt +++ b/runtime/doc/motion.txt @@ -1,4 +1,4 @@ -*motion.txt* For Vim version 7.0e. Last change: 2006 Apr 18 +*motion.txt* For Vim version 7.0e. Last change: 2006 Apr 22 VIM REFERENCE MANUAL by Bram Moolenaar @@ -769,6 +769,7 @@ g'{mark} g`{mark} *:marks* :marks List all the current marks (not a motion command). The |'(|, |')|, |'{| and |'}| marks are not listed. + The first column is number zero. {not in Vi} *E283* :marks {arg} List the marks that are mentioned in {arg} (not a diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index 5a37a8ddaf..3c021d8f7c 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1,4 +1,4 @@ -*pattern.txt* For Vim version 7.0e. Last change: 2006 Apr 02 +*pattern.txt* For Vim version 7.0e. Last change: 2006 Apr 22 VIM REFERENCE MANUAL by Bram Moolenaar @@ -342,6 +342,50 @@ For starters, read chapter 27 of the user manual |usr_27.txt|. ============================================================================== +3. Magic */magic* + +Some characters in the pattern are taken literally. They match with the same +character in the text. When preceded with a backslash however, these +characters get a special meaning. + +Other characters have a special meaning without a backslash. They need to be +preceded with a backslash to match literally. + +If a character is taken literally or not depends on the 'magic' option and the +items mentioned next. + */\m* */\M* +Use of "\m" makes the pattern after it be interpreted as if 'magic' is set, +ignoring the actual value of the 'magic' option. +Use of "\M" makes the pattern after it be interpreted as if 'nomagic' is used. + */\v* */\V* +Use of "\v" means that in the pattern after it all ASCII characters except +'0'-'9', 'a'-'z', 'A'-'Z' and '_' have a special meaning. "very magic" + +Use of "\V" means that in the pattern after it only the backslash has a +special meaning. "very nomagic" + +Examples: +after: \v \m \M \V matches ~ + 'magic' 'nomagic' + $ $ $ \$ matches end-of-line + . . \. \. matches any character + * * \* \* any number of the previous atom + () \(\) \(\) \(\) grouping into an atom + | \| \| \| separating alternatives + \a \a \a \a alphabetic character + \\ \\ \\ \\ literal backslash + \. \. . . literal dot + \{ { { { literal '{' + a a a a literal 'a' + +{only Vim supports \m, \M, \v and \V} + +It is recommended to always keep the 'magic' option at the default setting, +which is 'magic'. This avoids portability problems. To make a pattern immune +to the 'magic' option being set or not, put "\m" or "\M" at the start of the +pattern. + +============================================================================== 4. Overview of pattern items *pattern-overview* Overview of multi items. */multi* *E61* *E62* @@ -486,51 +530,6 @@ cat\Z Both "cat" and "càt" ("a" followed by 0x0300) ============================================================================== -3. Magic */magic* - -Some characters in the pattern are taken literally. They match with the same -character in the text. When preceded with a backslash however, these -characters get a special meaning. - -Other characters have a special meaning without a backslash. They need to be -preceded with a backslash to match literally. - -If a character is taken literally or not depends on the 'magic' option and the -items mentioned next. - */\m* */\M* -Use of "\m" makes the pattern after it be interpreted as if 'magic' is set, -ignoring the actual value of the 'magic' option. -Use of "\M" makes the pattern after it be interpreted as if 'nomagic' is used. - */\v* */\V* -Use of "\v" means that in the pattern after it all ASCII characters except -'0'-'9', 'a'-'z', 'A'-'Z' and '_' have a special meaning. "very magic" - -Use of "\V" means that in the pattern after it only the backslash has a -special meaning. "very nomagic" - -Examples: -after: \v \m \M \V matches ~ - 'magic' 'nomagic' - $ $ $ \$ matches end-of-line - . . \. \. matches any character - * * \* \* any number of the previous atom - () \(\) \(\) \(\) grouping into an atom - | \| \| \| separating alternatives - \a \a \a \a alphabetic character - \\ \\ \\ \\ literal backslash - \. \. . . literal dot - \{ { { { literal '{' - a a a a literal 'a' - -{only Vim supports \m, \M, \v and \V} - -It is recommended to always keep the 'magic' option at the default setting, -which is 'magic'. This avoids portability problems. To make a pattern immune -to the 'magic' option being set or not, put "\m" or "\M" at the start of the -pattern. - - -============================================================================== 5. Multi items *pattern-multi-items* An atom can be followed by an indication of how many times the atom can be diff --git a/runtime/doc/pi_tar.txt b/runtime/doc/pi_tar.txt index aa7e3f7f59..6c54891cef 100644 --- a/runtime/doc/pi_tar.txt +++ b/runtime/doc/pi_tar.txt @@ -1,4 +1,4 @@ -*tar.txt* For Vim version 7.0e. Last change: 2006 Mar 24 +*pi_tar.txt* For Vim version 7.0e. Last change: 2006 Apr 22 +====================+ | Tar File Interface | diff --git a/runtime/doc/pi_zip.txt b/runtime/doc/pi_zip.txt index 253639b8b3..26d9482017 100644 --- a/runtime/doc/pi_zip.txt +++ b/runtime/doc/pi_zip.txt @@ -1,4 +1,4 @@ -*zip.txt* For Vim version 7.0e. Last change: 2006 Apr 10 +*pi_zip.txt* For Vim version 7.0e. Last change: 2006 Apr 22 +====================+ | Zip File Interface | diff --git a/runtime/doc/sql.txt b/runtime/doc/sql.txt index cf956164ec..58f806a9d7 100644 --- a/runtime/doc/sql.txt +++ b/runtime/doc/sql.txt @@ -1,4 +1,4 @@ -*sql.txt* For Vim version 7.0e. Last change: Mon Apr 03 2006 10:34:00 PM +*sql.txt* For Vim version 7.0e. Last change: Fri Apr 21 2006 10:39:11 PM by David Fishburn @@ -82,7 +82,7 @@ The following keywords are supported: > create[ or replace] procedure|function|event returns -< + 1.2 Text Object Motions *sql-object-motions* ----------------------- @@ -96,7 +96,7 @@ file): > [[ move backwards to the previous 'begin' ][ move forward to the next 'end' [] move backwards to the previous 'end' -< + 1.3 Predefined Object Motions *sql-predefined-objects* ----------------------------- @@ -111,7 +111,7 @@ flexible as possible, you can override the list of objects from within your let g:ftplugin_sql_objects = 'function,procedure,event,table,trigger' . \ ',schema,service,publication,database,datatype,domain' . \ ',index,subscription,synchronization,view,variable' -< + The following |Normal| mode and |Visual| mode maps have been created which use the above list: > ]} move forward to the next 'create <object name>' @@ -128,14 +128,14 @@ Repeatedly pressing ]} will cycle through each of these create statements: > end; create index i1 on t1 (c1); -< + The default setting for g:ftplugin_sql_objects is: > let g:ftplugin_sql_objects = 'function,procedure,event,' . \ '\\(existing\\\\|global\\s\\+temporary\\s\\+\\)\\\{,1}' . \ 'table,trigger' . \ ',schema,service,publication,database,datatype,domain' . \ ',index,subscription,synchronization,view,variable' -< + The above will also handle these cases: > create table t1 ( ... @@ -146,7 +146,7 @@ The above will also handle these cases: > create global temporary table t3 ( ... ); -< + By default, the ftplugin only searches for CREATE statements. You can also override this via your |vimrc| with the following: > let g:ftplugin_sql_statements = 'create,alter' @@ -157,7 +157,7 @@ The filetype plugin defines three types of comments: > 3. /* * */ -< + The following |Normal| mode and |Visual| mode maps have been created to work with comments: > ]" move forward to the beginning of a comment @@ -170,7 +170,7 @@ with comments: > Vim's feature to find macro definitions, |'define'|, is supported using this regular expression: > \c\<\(VARIABLE\|DECLARE\|IN\|OUT\|INOUT\)\> -< + This addresses the following code: > CREATE VARIABLE myVar1 INTEGER; @@ -187,11 +187,11 @@ This addresses the following code: > FROM T1 WHERE c4 = myVar1; END; -< + Place your cursor on "myVar1" on this line: > WHERE c4 = myVar1; ^ -< + Press any of the following keys: > [d [D @@ -235,7 +235,7 @@ For the people that work with many different databases, it would be nice to be able to flip between the various vendors rules (indent, syntax) on a per buffer basis, at any time. The ftplugin/sql.vim file defines this function: > SQLSetType -< + Executing this function without any parameters will set the indent and syntax scripts back to their defaults, see |sql-type-default|. If you have turned off Vi's compatibility mode, |'compatible'|, you can use the <Tab> key to @@ -252,12 +252,12 @@ examples: > :SQLSetType sqlanywhere :SQLSetType sqlinformix :SQLSetType mysql -< + The easiest approach is to the use <Tab> character which will first complete the command name (SQLSetType), after a space and another <Tab>, display a list of available Vim script names: > :SQL<Tab><space><Tab> -< + 2.2 SQL Dialect Default *sql-type-default* ----------------------- @@ -267,10 +267,10 @@ your |vimrc|: > let g:sql_type_default = 'sqlanywhere' let g:sql_type_default = 'sqlinformix' let g:sql_type_default = 'mysql' -< + If you added the following to your |vimrc|: > let g:sql_type_default = 'sqlinformix' -< + The next time edit a SQL file the following scripts will be automatically loaded by Vim: > ftplugin/sql.vim @@ -299,7 +299,7 @@ can create any of the following: > Windows $VIM/vimfiles/syntax/sqlite.vim $VIM/vimfiles/indent/sqlite.vim -< + No changes are necessary to the SQLSetType function. It will automatically pickup the new SQL files and load them when you issue the SQLSetType command. @@ -330,11 +330,11 @@ The defaults static maps are: > imap <buffer> <C-C>o <C-\><C-O>:call sqlcomplete#Map('sqlOption')<CR><C-X><C-O> imap <buffer> <C-C>T <C-\><C-O>:call sqlcomplete#Map('sqlType')<CR><C-X><C-O> imap <buffer> <C-C>s <C-\><C-O>:call sqlcomplete#Map('sqlStatement')<CR><C-X><C-O> -< + The static maps (which are based on the syntax highlight groups) follow this format: > imap <buffer> <C-C>k <C-\><C-O>:call sqlcomplete#Map('sqlKeyword')<CR><C-X><C-O> -< + This command breaks down as: > imap - Create an insert map <buffer> - Only for this buffer @@ -362,7 +362,7 @@ This command breaks down as: > plugin will also cache this result until Vim is restarted. The syntax list is retrieved using the syntaxcomplete plugin. -< + Using the 'syntax' keyword is a special case. This instructs the syntaxcomplete plugin to retrieve all syntax items. So this will effectively work for any of Vim's SQL syntax files. At the time of writing this includes @@ -382,7 +382,7 @@ Here are some examples of the entries which are pulled from the syntax files: > - Isolation_level, On_error, Qualify_owners, Fire_triggers, ... Types - Integer, Char, Varchar, Date, DateTime, Timestamp, ... -< + 4.2 Dynamic Mode *sql-completion-dynamic* ---------------- @@ -402,7 +402,7 @@ to display a list of tables, procedures, views and columns. > - All stored procedures for all schema owners Column List - For the selected table, the columns that are part of the table -< + To enable the popup, while in INSERT mode, use the following key combinations for each group (where <C-C> means hold the CTRL key down while pressing the space bar): @@ -425,7 +425,7 @@ the popup window. This makes the re-displaying of these lists very fast. If new tables or columns are added to the database it may become necessary to clear the plugins cache. The default map for this is: > imap <buffer> <C-C>R <C-\><C-O>:call sqlcomplete#Map('ResetCache')<CR><C-X><C-O> -< + 4.3 SQL Tutorial *sql-completion-tutorial* ---------------- @@ -436,10 +436,10 @@ completion plugin so that: > b) You are introduced to some of the m |