0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

updated for version 7.0219

This commit is contained in:
Bram Moolenaar 2006-03-09 22:37:52 +00:00
parent 4ea8fe1d06
commit 1056d98844
18 changed files with 633 additions and 265 deletions

View File

@ -1,7 +1,7 @@
" Vim completion script
" Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2006 Mar 07
" Last Change: 2006 Mar 09
" This function is used for the 'omnifunc' option.
@ -64,6 +64,9 @@ function! ccomplete#Complete(findstart, base)
return []
endif
" init cache for vimgrep to empty
let s:grepCache = {}
" Split item in words, keep empty word after "." or "->".
" "aa" -> ['aa'], "aa." -> ['aa', ''], "aa.bb" -> ['aa', 'bb'], etc.
" We can't use split, because we need to skip nested [...].
@ -275,6 +278,11 @@ function! s:Nextitem(lead, items, depth, all)
let res = []
for tidx in range(len(tokens))
" Skip tokens starting with a non-ID character.
if tokens[tidx] !~ '^\h'
continue
endif
" Recognize "struct foobar" and "union foobar".
if (tokens[tidx] == 'struct' || tokens[tidx] == 'union') && tidx + 1 < len(tokens)
let res = s:StructMembers(tokens[tidx] . ':' . tokens[tidx + 1], a:items, a:all)
@ -349,20 +357,33 @@ function! s:StructMembers(typename, items, all)
let typename = a:typename
let qflist = []
let cached = 0
if a:all == 0
let n = '1' " stop at first found match
if has_key(s:grepCache, a:typename)
let qflist = s:grepCache[a:typename]
let cached = 1
endif
else
let n = ''
endif
while 1
exe 'silent! ' . n . 'vimgrep /\t' . typename . '\(\t\|$\)/j ' . fnames
let qflist = getqflist()
if len(qflist) > 0 || match(typename, "::") < 0
break
if !cached
while 1
exe 'silent! ' . n . 'vimgrep /\t' . typename . '\(\t\|$\)/j ' . fnames
let qflist = getqflist()
if len(qflist) > 0 || match(typename, "::") < 0
break
endif
" No match for "struct:context::name", remove "context::" and try again.
let typename = substitute(typename, ':[^:]*::', ':', '')
endwhile
if a:all == 0
" Store the result to be able to use it again later.
let s:grepCache[a:typename] = qflist
endif
" No match for "struct:context::name", remove "context::" and try again.
let typename = substitute(typename, ':[^:]*::', ':', '')
endwhile
endif
let matches = []
for l in qflist

View File

@ -1,8 +1,8 @@
" netrwFileHandlers: contains various extension-based file handlers for
" netrw's browsers' x command ("eXecute launcher")
" Author: Charles E. Campbell, Jr.
" Date: Oct 12, 2005
" Version: 7
" Date: Feb 15, 2006
" Version: 8a ASTRO-ONLY
" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
@ -22,22 +22,27 @@ if exists("g:loaded_netrwFileHandlers") || &cp
endif
let s:keepcpo= &cpo
set cpo&vim
let g:loaded_netrwFileHandlers= "v7"
let g:loaded_netrwFileHandlers= "v8a"
" ---------------------------------------------------------------------
" netrwFileHandlers#Init: {{{1
" This functions is here to allow a call to this function to autoload
" the netrwFileHandlers.vim file
fun! netrwFileHandlers#Init()
" call Dfunc("netrwFileHandlers#Init()")
" call Dret("netrwFileHandlers#Init")
" netrwFileHandlers#Invoke: {{{2
fun! netrwFileHandlers#Invoke(exten,fname)
" call Dfunc("netrwFileHandlers#Invoke(exten<".a:exten."> fname<".a:fname.">)")
if a:exten != "" && exists("*s:NFH_".a:exten)
" call Decho("let ret= netrwFileHandlers#NFH_".a:exten.'("'.a:fname.'")')
exe "let ret= s:NFH_".a:exten.'("'.a:fname.'")'
endif
" call Dret("netrwFileHandlers#Invoke 0 : ret=".ret)
return 0
endfun
" ---------------------------------------------------------------------
" netrwFileHandlers#NFH_html: handles html when the user hits "x" when the {{{1
" s:NFH_html: handles html when the user hits "x" when the {{{1
" cursor is atop a *.html file
fun! netrwFileHandlers#NFH_html(pagefile)
" call Dfunc("netrwFileHandlers#NFH_html(".a:pagefile.")")
fun! s:NFH_html(pagefile)
" call Dfunc("s:NFH_html(".a:pagefile.")")
let page= substitute(a:pagefile,'^','file://','')
@ -48,19 +53,19 @@ fun! netrwFileHandlers#NFH_html(pagefile)
" call Decho("executing !netscape ".page)
exe "!netscape \"".page.'"'
else
" call Dret("netrwFileHandlers#NFH_html 0")
" call Dret("s:NFH_html 0")
return 0
endif
" call Dret("netrwFileHandlers#NFH_html 1")
" call Dret("s:NFH_html 1")
return 1
endfun
" ---------------------------------------------------------------------
" netrwFileHandlers#NFH_htm: handles html when the user hits "x" when the {{{1
" s:NFH_htm: handles html when the user hits "x" when the {{{1
" cursor is atop a *.htm file
fun! netrwFileHandlers#NFH_htm(pagefile)
" call Dfunc("netrwFileHandlers#NFH_htm(".a:pagefile.")")
fun! s:NFH_htm(pagefile)
" call Dfunc("s:NFH_htm(".a:pagefile.")")
let page= substitute(a:pagefile,'^','file://','')
@ -71,18 +76,18 @@ fun! netrwFileHandlers#NFH_htm(pagefile)
" call Decho("executing !netscape ".page)
exe "!netscape \"".page.'"'
else
" call Dret("netrwFileHandlers#NFH_htm 0")
" call Dret("s:NFH_htm 0")
return 0
endif
" call Dret("netrwFileHandlers#NFH_htm 1")
" call Dret("s:NFH_htm 1")
return 1
endfun
" ---------------------------------------------------------------------
" netrwFileHandlers#NFH_jpg: {{{1
fun! netrwFileHandlers#NFH_jpg(jpgfile)
" call Dfunc("netrwFileHandlers#NFH_jpg(jpgfile<".a:jpgfile.">)")
" s:NFH_jpg: {{{1
fun! s:NFH_jpg(jpgfile)
" call Dfunc("s:NFH_jpg(jpgfile<".a:jpgfile.">)")
if executable("gimp")
exe "silent! !gimp -s ".a:jpgfile
@ -90,181 +95,181 @@ fun! netrwFileHandlers#NFH_jpg(jpgfile)
" call Decho("silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".escape(a:jpgfile," []|'"))
exe "!".expand("$SystemRoot")."/SYSTEM32/MSPAINT \"".a:jpgfile.'"'
else
" call Dret("netrwFileHandlers#NFH_jpg 0")
" call Dret("s:NFH_jpg 0")
return 0
endif
" call Dret("netrwFileHandlers#NFH_jpg 1")
" call Dret("s:NFH_jpg 1")
return 1
endfun
" ---------------------------------------------------------------------
" netrwFileHandlers#NFH_gif: {{{1
fun! netrwFileHandlers#NFH_gif(giffile)
" call Dfunc("netrwFileHandlers#NFH_gif(giffile<".a:giffile.">)")
" s:NFH_gif: {{{1
fun! s:NFH_gif(giffile)
" call Dfunc("s:NFH_gif(giffile<".a:giffile.">)")
if executable("gimp")
exe "silent! !gimp -s ".a:giffile
elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE")
exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT \"".a:giffile.'"'
else
" call Dret("netrwFileHandlers#NFH_gif 0")
" call Dret("s:NFH_gif 0")
return 0
endif
" call Dret("netrwFileHandlers#NFH_gif 1")
" call Dret("s:NFH_gif 1")
return 1
endfun
" ---------------------------------------------------------------------
" netrwFileHandlers#NFH_png: {{{1
fun! netrwFileHandlers#NFH_png(pngfile)
" call Dfunc("netrwFileHandlers#NFH_png(pngfile<".a:pngfile.">)")
" s:NFH_png: {{{1
fun! s:NFH_png(pngfile)
" call Dfunc("s:NFH_png(pngfile<".a:pngfile.">)")
if executable("gimp")
exe "silent! !gimp -s ".a:pngfile
elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE")
exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT \"".a:pngfile.'"'
else
" call Dret("netrwFileHandlers#NFH_png 0")
" call Dret("s:NFH_png 0")
return 0
endif
" call Dret("netrwFileHandlers#NFH_png 1")
" call Dret("s:NFH_png 1")
return 1
endfun
" ---------------------------------------------------------------------
" netrwFileHandlers#NFH_pnm: {{{1
fun! netrwFileHandlers#NFH_pnm(pnmfile)
" call Dfunc("netrwFileHandlers#NFH_pnm(pnmfile<".a:pnmfile.">)")
" s:NFH_pnm: {{{1
fun! s:NFH_pnm(pnmfile)
" call Dfunc("s:NFH_pnm(pnmfile<".a:pnmfile.">)")
if executable("gimp")
exe "silent! !gimp -s ".a:pnmfile
elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE")
exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT \"".a:pnmfile.'"'
else
" call Dret("netrwFileHandlers#NFH_pnm 0")
" call Dret("s:NFH_pnm 0")
return 0
endif
" call Dret("netrwFileHandlers#NFH_pnm 1")
" call Dret("s:NFH_pnm 1")
return 1
endfun
" ---------------------------------------------------------------------
" netrwFileHandlers#NFH_bmp: visualize bmp files {{{1
fun! netrwFileHandlers#NFH_bmp(bmpfile)
" call Dfunc("netrwFileHandlers#NFH_bmp(bmpfile<".a:bmpfile.">)")
" s:NFH_bmp: visualize bmp files {{{1
fun! s:NFH_bmp(bmpfile)
" call Dfunc("s:NFH_bmp(bmpfile<".a:bmpfile.">)")
if executable("gimp")
exe "silent! !gimp -s ".a:bmpfile
elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE")
exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT \"".a:bmpfile.'"'
else
" call Dret("netrwFileHandlers#NFH_bmp 0")
" call Dret("s:NFH_bmp 0")
return 0
endif
" call Dret("netrwFileHandlers#NFH_bmp 1")
" call Dret("s:NFH_bmp 1")
return 1
endfun
" ---------------------------------------------------------------------
" netrwFileHandlers#NFH_pdf: visualize pdf files {{{1
fun! netrwFileHandlers#NFH_pdf(pdf)
" " call Dfunc("netrwFileHandlers#NFH_pdf(pdf<".a:pdf.">)")
" s:NFH_pdf: visualize pdf files {{{1
fun! s:NFH_pdf(pdf)
" call Dfunc("s:NFH_pdf(pdf<".a:pdf.">)")
if executable("gs")
exe 'silent! !gs "'.a:pdf.'"'
else
" " call Dret("netrwFileHandlers#NFH_pdf 0")
" call Dret("s:NFH_pdf 0")
return 0
endif
" " call Dret("netrwFileHandlers#NFH_pdf 1")
" call Dret("s:NFH_pdf 1")
return 1
endfun
" ---------------------------------------------------------------------
" netrwFileHandlers#NFH_doc: visualize doc files {{{1
fun! netrwFileHandlers#NFH_doc(doc)
" " call Dfunc("netrwFileHandlers#NFH_doc(doc<".a:doc.">)")
" s:NFH_doc: visualize doc files {{{1
fun! s:NFH_doc(doc)
" call Dfunc("s:NFH_doc(doc<".a:doc.">)")
if executable("oowriter")
exe 'silent! !oowriter "'.a:doc.'"'
redraw!
else
" " call Dret("netrwFileHandlers#NFH_doc 0")
" call Dret("s:NFH_doc 0")
return 0
endif
" " call Dret("netrwFileHandlers#NFH_doc 1")
" call Dret("s:NFH_doc 1")
return 1
endfun
" ---------------------------------------------------------------------
" netrwFileHandlers#NFH_sxw: visualize sxw files {{{1
fun! netrwFileHandlers#NFH_sxw(sxw)
" " call Dfunc("netrwFileHandlers#NFH_sxw(sxw<".a:sxw.">)")
" s:NFH_sxw: visualize sxw files {{{1
fun! s:NFH_sxw(sxw)
" call Dfunc("s:NFH_sxw(sxw<".a:sxw.">)")
if executable("oowriter")
exe 'silent! !oowriter "'.a:sxw.'"'
redraw!
else
" " call Dret("netrwFileHandlers#NFH_sxw 0")
" call Dret("s:NFH_sxw 0")
return 0
endif
" " call Dret("netrwFileHandlers#NFH_sxw 1")
" call Dret("s:NFH_sxw 1")
return 1
endfun
" ---------------------------------------------------------------------
" netrwFileHandlers#NFH_xls: visualize xls files {{{1
fun! netrwFileHandlers#NFH_xls(xls)
" " call Dfunc("netrwFileHandlers#NFH_xls(xls<".a:xls.">)")
" s:NFH_xls: visualize xls files {{{1
fun! s:NFH_xls(xls)
" call Dfunc("s:NFH_xls(xls<".a:xls.">)")
if executable("oocalc")
exe 'silent! !oocalc "'.a:xls.'"'
redraw!
else
" " call Dret("netrwFileHandlers#NFH_xls 0")
" call Dret("s:NFH_xls 0")
return 0
endif
" " call Dret("netrwFileHandlers#NFH_xls 1")
" call Dret("s:NFH_xls 1")
return 1
endfun
" ---------------------------------------------------------------------
" netrwFileHandlers#NFH_ps: handles PostScript files {{{1
fun! netrwFileHandlers#NFH_ps(ps)
" call Dfunc("netrwFileHandlers#NFH_ps()")
" s:NFH_ps: handles PostScript files {{{1
fun! s:NFH_ps(ps)
" call Dfunc("s:NFH_ps(ps<".a:ps.">)")
if executable("gs")
" call Decho("exe silent! !gs ".a:ps)
exe "silent! !gs ".a:ps
redraw!
elseif executable("ghostscript")
exe "silent! !ghostscript ".a:ps
redraw!
elseif executable("ghostscript")
" call Decho("exe silent! !ghostscript ".a:ps)
exe "silent! !ghostscript ".a:ps
redraw!
elseif executable("gswin32")
" call Decho("exe silent! !gswin32 \"".a:ps.'"')
exe "silent! !gswin32 \"".a:ps.'"'
redraw!
else
" call Dret("netrwFileHandlers#NFH_ps 0")
" call Dret("s:NFH_ps 0")
return 0
endif
" call Dret("netrwFileHandlers#NFH_ps 1")
" call Dret("s:NFH_ps 1")
return 1
endfun
" ---------------------------------------------------------------------
" netrwFileHandlers#NFH_eps: handles encapsulated PostScript files {{{1
fun! netrwFileHandlers#NFH_eps(eps)
" call Dfunc("netrwFileHandlers#NFH_ps()")
" s:NFH_eps: handles encapsulated PostScript files {{{1
fun! s:NFH_eps(eps)
" call Dfunc("s:NFH_eps()")
if executable("gs")
exe "silent! !gs ".a:eps
redraw!
@ -278,40 +283,42 @@ fun! netrwFileHandlers#NFH_eps(eps)
exe "silent! !gswin32 \"".a:eps.'"'
redraw!
else
" call Dret("netrwFileHandlers#NFH_ps 0")
" call Dret("s:NFH_eps 0")
return 0
endif
endfun
" ---------------------------------------------------------------------
" netrwFileHandlers#NFH_fig: handles xfig files {{{1
fun! netrwFileHandlers#NFH_fig(fig)
" call Dfunc("netrwFileHandlers#NFH_fig()")
if executable("xfig")
exe "silent! !xfig ".a:fig
redraw!
else
" call Dret("netrwFileHandlers#NFH_fig 0")
return 0
endif
" call Dret("netrwFileHandlers#NFH_fig 1")
" call Dret("s:NFH_eps 0")
return 1
endfun
" ---------------------------------------------------------------------
" netrwFileHandlers#NFH_obj: handles tgif's obj files {{{1
fun! netrwFileHandlers#NFH_obj(obj)
" call Dfunc("netrwFileHandlers#NFH_obj()")
" s:NFH_fig: handles xfig files {{{1
fun! s:NFH_fig(fig)
" call Dfunc("s:NFH_fig()")
if executable("xfig")
exe "silent! !xfig ".a:fig
redraw!
else
" call Dret("s:NFH_fig 0")
return 0
endif
" call Dret("s:NFH_fig 1")
return 1
endfun
" ---------------------------------------------------------------------
" s:NFH_obj: handles tgif's obj files {{{1
fun! s:NFH_obj(obj)
" call Dfunc("s:NFH_obj()")
if has("unix") && executable("tgif")
exe "silent! !tgif ".a:obj
redraw!
else
" call Dret("netrwFileHandlers#NFH_obj 0")
" call Dret("s:NFH_obj 0")
return 0
endif
" call Dret("netrwFileHandlers#NFH_obj 1")
" call Dret("s:NFH_obj 1")
return 1
endfun

View File

@ -1,4 +1,4 @@
*filetype.txt* For Vim version 7.0aa. Last change: 2005 Sep 16
*filetype.txt* For Vim version 7.0aa. Last change: 2006 Mar 09
VIM REFERENCE MANUAL by Bram Moolenaar
@ -536,4 +536,10 @@ Since the text for this plugin is rather long it has been put in a separate
file: |pi_spec.txt|.
SQL *ft-sql*
Since the text for this plugin is rather long it has been put in a separate
file: |sql.txt|.
vim:tw=78:ts=8:ft=help:norl:

View File

@ -1,4 +1,4 @@
*quickfix.txt* For Vim version 7.0aa. Last change: 2006 Mar 08
*quickfix.txt* For Vim version 7.0aa. Last change: 2006 Mar 09
VIM REFERENCE MANUAL by Bram Moolenaar
@ -480,7 +480,7 @@ advantages are:
|gzip| |netrw|
To be able to do this Vim loads each file as if it is being edited. When
there is no match in the file the assicated buffer is wiped out again. The
there is no match in the file the associated buffer is wiped out again. The
'hidden' option is ignored here to avoid running out of memory or file
descriptors when searching many files. However, when the |:hide| command
modifier is used the buffers are kept loaded. This makes following searches

298
runtime/doc/sql.txt Normal file
View File

@ -0,0 +1,298 @@
*sql.txt* For Vim version 7.0aa. Last change: Fri Jan 06 2006 8:09:25 AM
by David Fishburn
This is a filetype plugin to work with SQL files.
The Structured Query Language (SQL) is a standard which specifies statements
that allow a user to interact with a relational database. Vim includes
features for navigation, indentation and syntax highlighting.
1. Navigation |sql-navigation|
1.1 Matchit |sql-matchit|
1.2 Text Object Motions |sql-object-motions|
1.3 Predefined Object Motions |sql-predefined-objects|
1.4 Macros |sql-macros|
2. SQL Dialects |sql-dialects|
2.1 SQLSetType |SQLSetType|
2.2 SQL Dialect Default |sql-type-default|
3. Adding new SQL Dialects |sql-adding-dialects|
==============================================================================
1. Navigation *sql-navigation*
The SQL ftplugin provides a number of options to assist with file
navigation.
1.1 Matchit *sql-matchit*
-----------
The matchit plugin (http://www.vim.org/scripts/script.php?script_id=39)
provides many additional features and can be customized for different
languages. The matchit plugin is configured by defining a local
buffer variable, b:match_words. Pressing the % key while on various
keywords will move the cursor to its match. For example, if the cursor
is on an "if", pressing % will cycle between the "else", "elseif" and
"end if" keywords.
The following keywords are supported: >
if
elseif | elsif
else [if]
end if
[while condition] loop
leave
break
continue
exit
end loop
for
leave
break
continue
exit
end loop
do
statements
doend
case
when
when
default
end case
merge
when not matched
when matched
create[ or replace] procedure|function|event
returns
<
1.2 Text Object Motions *sql-object-motions*
-----------------------
Vim has a number of predefined keys for working with text |object-motions|.
This filetype plugin attempts to translate these keys to maps which make sense
for the SQL language.
The following |Normal| mode and |Visual| mode maps exist (when you edit a SQL
file): >
]] move forward to the next 'begin'
[[ 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*
-----------------------------
Most relational databases support various standard features, tables, indicies,
triggers and stored procedures. Each vendor also has a variety of proprietary
objects. The next set of maps have been created to help move between these
objects. Depends on which database vendor you are using, the list of objects
must be configurable. The filetype plugin attempts to define many of the
standard objects, plus many additional ones. In order to make this as
flexible as possible, you can override the list of objects from within your
|vimrc| with the following: >
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>'
[{ move backward to the previous 'create <object name>'
Repeatedly pressing ]} will cycle through each of these create statements: >
create table t1 (
...
);
create procedure p1
begin
...
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 (
...
);
create existing table t2 (
...
);
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'
The filetype plugin defines three types of comments: >
1. --
2. //
3. /*
*
*/
<
The following |Normal| mode and |Visual| mode maps have been created to work
with comments: >
]" move forward to the beginning of a comment
[" move forward to the end of a comment
1.4 Macros *sql-macros*
----------
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;
CREATE PROCEDURE sp_test(
IN myVar2 INTEGER,
OUT myVar3 CHAR(30),
INOUT myVar4 NUMERIC(20,0)
)
BEGIN
DECLARE myVar5 INTEGER;
SELECT c1, c2, c3
INTO myVar2, myVar3, myVar4
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
[CTRL-D
==============================================================================
2. SQL Dialects *sql-dialects* *sql-types*
*sybase* *TSQL* *Transact-SQL*
*sqlanywhere*
*oracle* *plsql* *sqlj*
*sqlserver*
*mysql* *postgress* *psql*
*informix*
All relational databases support SQL. There is a portion of SQL that is
portable across vendors (ex. CREATE TABLE, CREATE INDEX), but there is a
great deal of vendor specific extensions to SQL. Oracle supports the
"CREATE OR REPLACE" syntax, column defaults specified in the CREATE TABLE
statement and the procedural language (for stored procedures and triggers).
The default Vim distribution ships with syntax highlighting based on Oracle's
PL/SQL. The default SQL indent script works for Oracle and SQL Anywhere.
The default filetype plugin works for all vendors and should remain vendor
neutral, but extendable.
Vim currently has support for a variety of different vendors, currently this
is via syntax scripts. Unfortunately, to flip between different syntax rules
you must either create:
1. New filetypes
2. Custom autocmds
3. Manual steps / commands
The majority of people work with only one vendor's database product, it would
be nice to specify a default in your |vimrc|.
2.1 SQLSetType *sqlsettype* *SQLSetType*
--------------
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
complete the optional parameter.
After typing the function name and a space, you can use the completion to
supply a parameter. The function takes the name of the Vim script you want to
source. Using the |cmdline-completion| feature, the SQLSetType function will
search the |'runtimepath'| for all Vim scripts with a name containing 'sql'.
This takes the guess work out of the spelling of the names. The following are
examples: >
:SQLSetType
:SQLSetType sqloracle
: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*
-----------------------
As mentioned earlier, the default syntax rules for Vim is based on Oracle
(PL/SQL). You can override this default by placing one of the following in
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
syntax/sqlinformix.vim
indent/sql.vim
>
Notice indent/sqlinformix.sql was not loaded. There is no indent file
for Informix, Vim loads the default files if the specified files does not
exist.
==============================================================================
3. Adding new SQL Dialects *sql-adding-dialects*
If you begin working with a SQL dialect which does not have any customizations
available with the default Vim distribution you can check http://www.vim.org
to see if any customization currently exist. If not, you can begin by cloning
an existing script. Read |filetype-plugins| for more details.
To help identify these scripts, try to create the files with a "sql" prefix.
If you decide you wish to create customizations for the SQLite database, you
can create any of the following: >
Unix
~/.vim/syntax/sqlite.vim
~/.vim/indent/sqlite.vim
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.
vim:tw=78:ts=8:ft=help:norl:ff=unix:

View File

@ -1,4 +1,4 @@
*syntax.txt* For Vim version 7.0aa. Last change: 2006 Mar 01
*syntax.txt* For Vim version 7.0aa. Last change: 2006 Mar 09
VIM REFERENCE MANUAL by Bram Moolenaar
@ -2374,13 +2374,18 @@ the syntax file.
SQL *sql.vim* *ft-sql-syntax*
*sqlinformix.vim* *ft-sqlinformix-syntax*
*sqlanywhere.vim* *ft-sqlanywhere-syntax*
While there is an ANSI standard for SQL, most database engines add their
own custom extensions. Vim currently supports the Oracle and Informix
dialects of SQL. Vim assumes "*.sql" files are Oracle SQL by default.
While there is an ANSI standard for SQL, most database engines add their own
custom extensions. Vim currently supports the Oracle and Informix dialects of
SQL. Vim assumes "*.sql" files are Oracle SQL by default.
If you want to use the Informix dialect, put this in your startup vimrc: >
:let g:filetype_sql = "sqlinformix"
Vim currently has SQL support for a variety of different vendors via syntax
scripts. You can change Vim's default from Oracle to any of the current SQL
supported types. You can also easily alter the SQL dialect being used on a
buffer by buffer basis.
For more detailed instructions see |sql.txt|.
TCSH *tcsh.vim* *ft-tcsh-syntax*

View File

@ -1,4 +1,4 @@
*todo.txt* For Vim version 7.0aa. Last change: 2006 Mar 08
*todo.txt* For Vim version 7.0aa. Last change: 2006 Mar 09
VIM REFERENCE MANUAL by Bram Moolenaar
@ -30,18 +30,11 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
*known-bugs*
-------------------- Known bugs and current work -----------------------
Bug in Netbeans interface. (Xavier de Gaye, 2006 Mar 7)
Code for "insert" is wrong. Don't use b_p_eol or b_start_eol.
Handle partial lines properly. What probably should happen is to append to a
line when "off" points to the NUL after that line, insert before a line when
the text doesn't end in a "\n" and only insert line breaks where there is a
"\n" in the argument.
Win32: Describe how to do debugging and describe it. (George Reilly)
Win32: Describe how to do debugging. (George Reilly)
Mac unicode patch (Da Woon Jung):
- Mac: Unicode input and display (Eckehard Berns, 2004 June 27)
Other patch from Da Woon Jung, 2005 Jan 16.
- Mac: Unicode input and display (Eckehard Berns)
Included patch from Da Woon Jung, not complete yet.
8 Add patch from Muraoka Taro (Mar 16) to support input method on Mac?
New patch 2004 Jun 16
- Add default key mappings for the command key (Alan Schmitt)
@ -52,15 +45,13 @@ Mac unicode patch (Da Woon Jung):
- With 'nopaste' pasting is wrong, with 'paste' Command-V doesn't work.
(Alan Schmitt)
Add ShellCmdPre/ShellCmdPost/ShellFilterPre/ShellFilterPost ?
Useful for updating the diretory listing in netrw.
CONSIDERED FOR VERSION 7.0:
Omni completion:
ccomplete:
- Finding out if an item has members (to add '.' or '->') requires a grep
in the tags files, that is very slow. Is there another solution?
Check what happens when taglist() is called.
Could build the list of items for each structure in memory. Is that
faster? Not using too much memory?
- For C add tag "kind" field to each match?
- Flickering because of syntax highlighting redrawing further lines.
- When a typedef or struct is local to a file only use it in that file?
@ -274,6 +265,7 @@ Awaiting updated patches:
runtime files?
Also: when the environment variable exists, use it. If it doesn't
exist, set it. Requires good names: $VIM_USER_VIMRC $VIM_USER_DIR
Add a menu item "Preferences" that does "sp $MYVIMRC".
- The Replace dialog takes "\r" literal, unless "replace all" is used.
Need to escape backslashes.
Win32: the text to replace with isn't remembered.
@ -539,6 +531,9 @@ GUI:
8 When fontset support is enabled, setting 'guifont' to a single font
doesn't work.
8 Menu priority for sub-menus for: Amiga, BeOS.
8 When translating menus ignore the part after the Tab, the shortcut. So
that the same menu item with a different shortcut (e.g., for the Mac) are
still translated.
8 Add menu separators for Amiga, RISCOS.
8 Add way to specify the file filter for the browse dialog. At least for
browse().
@ -1633,6 +1628,8 @@ Built-in script language:
Alternative: Allow range for ":exec", pass it on to the executed command.
(Webb)
You can already yank lines and use :@" to execute them.
7 ":include" command: just like ":source" but doesn't start a new scriptID?
Will be tricky for the list of script names.
8 Have a look at VSEL. Would it be useful to include? (Bigham)
8 Add ":fungroup" command, to group function definitions together. When
encountered, all functions in the group are removed. Suggest using an

View File

@ -1,4 +1,4 @@
*version7.txt* For Vim version 7.0aa. Last change: 2006 Mar 08
*version7.txt* For Vim version 7.0aa. Last change: 2006 Mar 09
VIM REFERENCE MANUAL by Bram Moolenaar
@ -689,6 +689,8 @@ ABAB/4 syntax file. (Marius van Wyk)
SQL-Informix syntax file. (Dean L Hill)
Handling of various SQL variants. (David Fishburn)
PHP compiler plugin. (Doug Kearns)
Sive syntax file. (Nikolai Weibull)
@ -730,6 +732,9 @@ Others: ~
The Netbeans interface was updated for Sun Studio 10. The protocol number
goes from 2.2 to 2.3. (Gordon Prieur)
Mac: When starting up Vim will load the $VIMRUNTIME/macmap.vim script to
define default command-key mappings.
Mac: Add the selection type to the clipboard, so that Block, line and
character selections can be used between two Vims. (Eckehard Berns)
Also fixes the problem that setting 'clipboard' to "unnamed" breaks using

View File

@ -1,7 +1,7 @@
" Set options and add mapping such that Vim behaves a lot like MS-Windows
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2006 Feb 02
" Last change: 2006 Mar 09
" bail out if this isn't wanted (mrsvim.vim uses this).
if exists("g:skip_loading_mswin") && g:skip_loading_mswin
@ -41,36 +41,11 @@ cmap <S-Insert> <C-R>+
" Pasting blockwise and linewise selections is not possible in Insert and
" Visual mode without the +virtualedit feature. They are pasted as if they
" were characterwise instead.
" Note: the same stuff appears in menu.vim.
if has("virtualedit")
nnoremap <silent> <SID>Paste :call <SID>Paste()<CR>
func! <SID>Paste()
let ove = &ve
set ve=all
normal! `^
if @+ != ''
normal! "+gP
endif
let c = col(".")
normal! i
if col(".") < c " compensate for i<ESC> moving the cursor left
" Avoid a beep when the text ends at the window edge.
let vb_save = &vb
let t_vb_save = &t_vb
set vb t_vb=
normal! l
let &vb = vb_save
let &t_vb = t_vb_save
endif
let &ve = ove
endfunc
inoremap <script> <C-V> x<BS><Esc><SID>Pastegi
vnoremap <script> <C-V> "-c<Esc><SID>Paste
else
nnoremap <silent> <SID>Paste "=@+.'xy'<CR>gPFx"_2x
inoremap <script> <C-V> x<Esc><SID>Paste"_s
vnoremap <script> <C-V> "-c<Esc>gix<Esc><SID>Paste"_x
endif
" Uses the paste.vim autoload script.
exe 'inoremap <script> <C-V>' paste#paste_cmd['i']
exe 'vnoremap <script> <C-V>' paste#paste_cmd['v']
imap <S-Insert> <C-V>
vmap <S-Insert> <C-V>

View File

@ -1,89 +1,39 @@
" Vim syntax file
" Language: SQL, PL/SQL (Oracle 8i)
" Maintainer: Paul Moore <pf_moore AT yahoo.co.uk>
" Last Change: 2005 Dec 23
" Vim syntax file loader
" Language: SQL
" Maintainer: David Fishburn <fishburn at ianywhere dot com>
" Last Change: Thu Sep 15 2005 10:30:02 AM
" Version: 1.0
" Description: Checks for a:
" buffer local variable,
" global variable,
" If the above exist, it will source the type specified.
" If none exist, it will source the default sql.vim file.
"
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
syntax clear
elseif exists("b:current_syntax")
finish
finish
endif
syn case ignore
" Default to the standard Vim distribution file
let filename = 'sqloracle'
" The SQL reserved words, defined as keywords.
syn keyword sqlSpecial false null true
syn keyword sqlKeyword access add as asc begin by check cluster column
syn keyword sqlKeyword compress connect current cursor decimal default desc
syn keyword sqlKeyword else elsif end exception exclusive file for from
syn keyword sqlKeyword function group having identified if immediate increment
syn keyword sqlKeyword index initial into is level loop maxextents mode modify
syn keyword sqlKeyword nocompress nowait of offline on online start
syn keyword sqlKeyword successful synonym table then to trigger uid
syn keyword sqlKeyword unique user validate values view whenever
syn keyword sqlKeyword where with option order pctfree privileges procedure
syn keyword sqlKeyword public resource return row rowlabel rownum rows
syn keyword sqlKeyword session share size smallint type using
syn keyword sqlOperator not and or
syn keyword sqlOperator in any some all between exists
syn keyword sqlOperator like escape
syn keyword sqlOperator union intersect minus
syn keyword sqlOperator prior distinct
syn keyword sqlOperator sysdate out
syn keyword sqlStatement alter analyze audit comment commit create
syn keyword sqlStatement delete drop execute explain grant insert lock noaudit
syn keyword sqlStatement rename revoke rollback savepoint select set
syn keyword sqlStatement truncate update
syn keyword sqlType boolean char character date float integer long
syn keyword sqlType mlslabel number raw rowid varchar varchar2 varray
" Strings and characters:
syn region sqlString start=+"+ skip=+\\\\\|\\"+ end=+"+
syn region sqlString start=+'+ skip=+\\\\\|\\'+ end=+'+
" Numbers:
syn match sqlNumber "-\=\<\d*\.\=[0-9_]\>"
" Comments:
syn region sqlComment start="/\*" end="\*/" contains=sqlTodo
syn match sqlComment "--.*$" contains=sqlTodo
syn sync ccomment sqlComment
" Todo.
syn keyword sqlTodo contained TODO FIXME XXX DEBUG NOTE
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_sql_syn_inits")
if version < 508
let did_sql_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink sqlComment Comment
HiLink sqlKeyword sqlSpecial
HiLink sqlNumber Number
HiLink sqlOperator sqlStatement
HiLink sqlSpecial Special
HiLink sqlStatement Statement
HiLink sqlString String
HiLink sqlType Type
HiLink sqlTodo Todo
delcommand HiLink
" Check for overrides. Buffer variables have the highest priority.
if exists("b:sql_type_override")
" Check the runtimepath to see if the file exists
if globpath(&runtimepath, 'syntax/'.b:sql_type_override.'.vim') != ''
let filename = b:sql_type_override
endif
elseif exists("g:sql_type_default")
if globpath(&runtimepath, 'syntax/'.g:sql_type_default.'.vim') != ''
let filename = g:sql_type_default
endif
endif
let b:current_syntax = "sql"
" Source the appropriate file
exec 'runtime syntax/'.filename.'.vim'
" vim: ts=8
" vim:sw=4:ff=unix:

View File

@ -0,0 +1,89 @@
" Vim syntax file
" Language: SQL, PL/SQL (Oracle 8i)
" Maintainer: Paul Moore <pf_moore AT yahoo.co.uk>
" Last Change: 2005 Dec 23
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syn case ignore
" The SQL reserved words, defined as keywords.
syn keyword sqlSpecial false null true
syn keyword sqlKeyword access add as asc begin by check cluster column
syn keyword sqlKeyword compress connect current cursor decimal default desc
syn keyword sqlKeyword else elsif end exception exclusive file for from
syn keyword sqlKeyword function group having identified if immediate increment
syn keyword sqlKeyword index initial into is level loop maxextents mode modify
syn keyword sqlKeyword nocompress nowait of offline on online start
syn keyword sqlKeyword successful synonym table then to trigger uid
syn keyword sqlKeyword unique user validate values view whenever
syn keyword sqlKeyword where with option order pctfree privileges procedure
syn keyword sqlKeyword public resource return row rowlabel rownum rows
syn keyword sqlKeyword session share size smallint type using
syn keyword sqlOperator not and or
syn keyword sqlOperator in any some all between exists
syn keyword sqlOperator like escape
syn keyword sqlOperator union intersect minus
syn keyword sqlOperator prior distinct
syn keyword sqlOperator sysdate out
syn keyword sqlStatement alter analyze audit comment commit create
syn keyword sqlStatement delete drop execute explain grant insert lock noaudit
syn keyword sqlStatement rename revoke rollback savepoint select set
syn keyword sqlStatement truncate update
syn keyword sqlType boolean char character date float integer long
syn keyword sqlType mlslabel number raw rowid varchar varchar2 varray
" Strings and characters:
syn region sqlString start=+"+ skip=+\\\\\|\\"+ end=+"+
syn region sqlString start=+'+ skip=+\\\\\|\\'+ end=+'+
" Numbers:
syn match sqlNumber "-\=\<\d*\.\=[0-9_]\>"
" Comments:
syn region sqlComment start="/\*" end="\*/" contains=sqlTodo
syn match sqlComment "--.*$" contains=sqlTodo
syn sync ccomment sqlComment
" Todo.
syn keyword sqlTodo contained TODO FIXME XXX DEBUG NOTE
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_sql_syn_inits")
if version < 508
let did_sql_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink sqlComment Comment
HiLink sqlKeyword sqlSpecial
HiLink sqlNumber Number
HiLink sqlOperator sqlStatement
HiLink sqlSpecial Special
HiLink sqlStatement Statement
HiLink sqlString String
HiLink sqlType Type
HiLink sqlTodo Todo
delcommand HiLink
endif
let b:current_syntax = "sql"
" vim: ts=8

View File

@ -177,23 +177,17 @@ extern char MetaCharTable[];
* Character that separates dir names in a path.
* For MS-DOS, WIN32 and OS/2 we use a backslash. A slash mostly works
* fine, but there are places where it doesn't (e.g. in a command name).
* For Macintosh we use a colon.
* For Acorn we use a dot.
*/
#ifdef BACKSLASH_IN_FILENAME
# define PATHSEP psepc
# define PATHSEPSTR pseps
#else
# ifdef COLON_AS_PATHSEP
# define PATHSEP ':'
# define PATHSEPSTR ":"
# ifdef RISCOS
# define PATHSEP '.'
# define PATHSEPSTR "."
# else
# ifdef RISCOS
# define PATHSEP '.'
# define PATHSEPSTR "."
# else
# define PATHSEP '/'
# define PATHSEPSTR "/"
# endif
# define PATHSEP '/'
# define PATHSEPSTR "/"
# endif
#endif

View File

@ -19326,8 +19326,7 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
profile_end(&fp->uf_tm_start);
profile_sub_wait(&wait_start, &fp->uf_tm_start);
profile_add(&fp->uf_tm_total, &fp->uf_tm_start);
profile_add(&fp->uf_tm_self, &fp->uf_tm_start);
profile_sub(&fp->uf_tm_self, &fp->uf_tm_children);
profile_self(&fp->uf_tm_self, &fp->uf_tm_start, &fp->uf_tm_children);
if (fc.caller != NULL && &fc.caller->func->uf_profiling)
{
profile_add(&fc.caller->func->uf_tm_children, &fp->uf_tm_start);
@ -19714,9 +19713,9 @@ func_line_end(cookie)
++fp->uf_tml_count[fp->uf_tml_idx];
profile_end(&fp->uf_tml_start);
profile_sub_wait(&fp->uf_tml_wait, &fp->uf_tml_start);
profile_add(&fp->uf_tml_self[fp->uf_tml_idx], &fp->uf_tml_start);
profile_add(&fp->uf_tml_total[fp->uf_tml_idx], &fp->uf_tml_start);
profile_sub(&fp->uf_tml_self[fp->uf_tml_idx], &fp->uf_tml_children);
profile_self(&fp->uf_tml_self[fp->uf_tml_idx], &fp->uf_tml_start,
&fp->uf_tml_children);
}
fp->uf_tml_idx = -1;
}

View File

@ -910,6 +910,28 @@ profile_add(tm, tm2)
# endif
}
/*
* Add the "self" time from the total time and the children's time.
*/
void
profile_self(self, total, children)
proftime_T *self, *total, *children;
{
/* Check that the result won't be negative. Can happen with recursive
* calls. */
#ifdef WIN3264
if (total->QuadPart <= children->QuadPart)
return;
#else
if (total->tv_sec < children->tv_sec
|| (total->tv_sec == children->tv_sec
&& total->tv_usec <= children->tv_usec))
return;
#endif
profile_add(self, total);
profile_sub(self, children);
}
/*
* Get the current waittime.
*/
@ -3000,8 +3022,8 @@ do_source(fname, check_other, is_vimrc)
profile_end(&si->sn_pr_start);
profile_sub_wait(&wait_start, &si->sn_pr_start);
profile_add(&si->sn_pr_total, &si->sn_pr_start);
profile_add(&si->sn_pr_self, &si->sn_pr_start);
profile_sub(&si->sn_pr_self, &si->sn_pr_children);
profile_self(&si->sn_pr_self, &si->sn_pr_start,
&si->sn_pr_children);
}
}
#endif
@ -3505,9 +3527,9 @@ script_line_end()
++pp->snp_count;
profile_end(&si->sn_prl_start);
profile_sub_wait(&si->sn_prl_wait, &si->sn_prl_start);
profile_add(&pp->sn_prl_self, &si->sn_prl_start);
profile_add(&pp->sn_prl_total, &si->sn_prl_start);
profile_sub(&pp->sn_prl_self, &si->sn_prl_children);
profile_self(&pp->sn_prl_self, &si->sn_prl_start,
&si->sn_prl_children);
}
si->sn_prl_idx = -1;
}

View File

@ -2589,6 +2589,9 @@ source_startup_scripts(parmp)
#ifdef SYS_VIMRC_FILE
(void)do_source((char_u *)SYS_VIMRC_FILE, FALSE, FALSE);
#endif
#ifdef MACOS_X
(void)do_source((char_u *)"$VIMRUNTIME/macmap.vim", FALSE, FALSE);
#endif
/*
* Try to read initialization commands from the following places:

View File

@ -2647,7 +2647,7 @@ ml_append_int(buf, lnum, line, len, newfile, mark)
/*
* Replace line lnum, with buffering, in current buffer.
*
* If copy is TRUE, make a copy of the line, otherwise the line has been
* If "copy" is TRUE, make a copy of the line, otherwise the line has been
* copied to allocated memory already.
*
* Check: The caller of this function should probably also call

View File

@ -4430,12 +4430,8 @@ vim_ispathsep(c)
/* server"user passwd"::device:[full.path.name]fname.extension;version" */
return (c == ':' || c == '[' || c == ']' || c == '/'
|| c == '<' || c == '>' || c == '"' );
# else
# ifdef COLON_AS_PATHSEP
return (c == ':');
# else /* Amiga */
# else /* Amiga */
return (c == ':' || c == '/');
# endif
# endif /* VMS */
# endif
# endif

View File

@ -15,6 +15,7 @@ void profile_start __ARGS((proftime_T *tm));
void profile_end __ARGS((proftime_T *tm));
void profile_sub __ARGS((proftime_T *tm, proftime_T *tm2));
void profile_add __ARGS((proftime_T *tm, proftime_T *tm2));
void profile_self __ARGS((proftime_T *self, proftime_T *total, proftime_T *children));
void profile_get_wait __ARGS((proftime_T *tm));
void profile_sub_wait __ARGS((proftime_T *tm, proftime_T *tma));
int profile_equal __ARGS((proftime_T *tm1, proftime_T *tm2));