diff options
author | Bram Moolenaar <Bram@vim.org> | 2008-06-25 20:13:35 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2008-06-25 20:13:35 +0000 |
commit | aba8857aa3dac629dc9c2a61c70bceee8b095e14 (patch) | |
tree | d2ba4671d3af28fb2b87110b7eae7b573f257904 /runtime/doc | |
parent | 7b6d4a8ce837e4a0b8484dbbacb4ebcc9995f6fb (diff) |
updated for version 7.2a-00v7.2a.00
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/ada.txt | 515 | ||||
-rw-r--r-- | runtime/doc/sql.txt | 763 |
2 files changed, 0 insertions, 1278 deletions
diff --git a/runtime/doc/ada.txt b/runtime/doc/ada.txt deleted file mode 100644 index 6054ac7e1f..0000000000 --- a/runtime/doc/ada.txt +++ /dev/null @@ -1,515 +0,0 @@ -*ada.txt* For Vim version 7.1. Last change: 2007 May 08 - - - ADA FILE TYPE PLUG-INS REFERENCE MANUAL~ - -ADA *ada.vim* - -1. Syntax Highlighting |ft-ada-syntax| -2. Plug-in |ft-ada-plugin| -3. Omni Completion |ft-ada-omni| - 3.1 Omni Completion with "gnat xref" |gnat-xref| - 3.2 Omni Completion with "ctags" |ada-ctags| -4. Compiler Support |ada-compiler| - 4.1 GNAT |compiler-gnat| - 4.1 Dec Ada |compiler-decada| -5. References |ada-reference| - 5.1 Options |ft-ada-options| - 5.2 Functions |ft-ada-functions| - 5.3 Commands |ft-ada-commands| - 5.4 Variables |ft-ada-variables| - 5.5 Constants |ft-ada-constants| -8. Extra Plug-ins |ada-extra-plugins| - -============================================================================== -1. Syntax Highlighting ~ - *ft-ada-syntax* - -This mode is designed for the 2005 edition of Ada ("Ada 2005"), which includes -support for objected-programming, protected types, and so on. It handles code -written for the original Ada language ("Ada83", "Ada87", "Ada95") as well, -though code which uses Ada 2005-only keywords will be wrongly colored (such -code should be fixed anyway). For more information about Ada, see -http://www.adapower.com. - -The Ada mode handles a number of situations cleanly. - -For example, it knows that the "-" in "-5" is a number, but the same character -in "A-5" is an operator. Normally, a "with" or "use" clause referencing -another compilation unit is coloured the same way as C's "#include" is coloured. -If you have "Conditional" or "Repeat" groups coloured differently, then "end -if" and "end loop" will be coloured as part of those respective groups. - -You can set these to different colours using vim's "highlight" command (e.g., -to change how loops are displayed, enter the command ":hi Repeat" followed by -the colour specification; on simple terminals the colour specification -ctermfg=White often shows well). - -There are several options you can select in this Ada mode. See|ft-ada-options| -for a complete list. - -To enable them, assign a value to the option. For example, to turn one on: - > - > let g:ada_standard_types = 1 -> -To disable them use ":unlet". Example: -> - > unlet g:ada_standard_types - -You can just use ":" and type these into the command line to set these -temporarily before loading an Ada file. You can make these option settings -permanent by adding the "let" command(s), without a colon, to your "~/.vimrc" -file. - -Even on a slow (90Mhz) PC this mode works quickly, but if you find the -performance unacceptable, turn on |g:ada_withuse_ordinary|. - -Syntax folding instructions (|fold-syntax|) are added when |g:ada_folding| is -set. - -============================================================================== -2. File type Plug-in ~ - *ft-ada-indent* *ft-ada-plugin* - -The Ada plug-in provides support for: - - - auto indenting (|indent.txt|) - - insert completion (|i_CTRL-N|) - - user completion (|i_CTRL-X_CTRL-U|) - - tag searches (|tagsrch.txt|) - - Quick Fix (|quickfix.txt|) - - backspace handling (|'backspace'|) - - comment handling (|'comments'|, |'commentstring'|) - -The plug-in only activates the features of the Ada mode whenever an Ada -files is opened and add adds Ada related entries to the main and pop-up menu. - -============================================================================== -3. Omni Completion ~ - *ft-ada-omni* - -The Ada omni-completions (|i_CTRL-X_CTRL-O|) uses tags database created either -by "gnat xref -v" or the "exuberant Ctags (http://ctags.sourceforge.net). The -complete function will automatically detect which tool was used to create the -tags file. - ------------------------------------------------------------------------------- -3.1 Omni Completion with "gnat xref" ~ - *gnat-xref* - -GNAT XREF uses the compiler internal informations (ali-files) to produce the -tags file. This has the advantage to be 100% correct and the option of deep -nested analysis. However the code must compile, the generator is quite -slow and the created tags file contains only the basic Ctags informations for -each entry - not enough for some of the more advanced Vim code browser -plug-ins. - -NOTE: "gnat xref -v" is very tricky to use as it has almost no diagnostic - output - If nothing is printed then usually the parameters are wrong. - Here some important tips: - -1) You need to compile your code first and use the "-aO" option to point to - your .ali files. -2) "gnat xref -v ../Include/adacl.ads" won't work - use the "gnat xref -v - -aI../Include adacl.ads" instead. -3) "gnat xref -v -aI../Include *.ad?" won't work - use "cd ../Include" and - then "gnat xref -v *.ad?" -4) Project manager support is completely broken - don't even try "gnat xref - -Padacl.gpr". -5) VIM is faster when the tags file is sorted - use "sort --unique - --ignore-case --output=tags tags" . -6) Remember to insert "!_TAG_FILE_SORTED 2 %sort ui" as first line to mark - the file assorted. - ------------------------------------------------------------------------------- -3.2 Omni Completion with "ctags"~ - *ada-ctags* - -Exuberant Ctags uses its own multi-language code parser. The parser is quite -fast, produces a lot of extra informations (hence the name "Exuberant Ctags") -and can run on files which currently do not compile. - -There are also lots of other Vim-tools which use exuberant Ctags. - -You will need to install a version of the Exuberant Ctags which has Ada -support patched in. Such a version is available from the GNU Ada Project -(http://gnuada.sourceforge.net). - -The Ada parser for Exuberant Ctags is fairly new - don't expect complete -support yet. - -============================================================================== -4. Compiler Support ~ - *ada-compiler* - -The Ada mode supports more then one Ada compiler and will automatically load the -compiler set in|g:ada_default_compiler|whenever an Ada source is opened. The -provided compiler plug-ins are split into the actual compiler plug-in and a -collection of support functions and variables. This allows the easy -development of specialized compiler plug-ins fine tuned to your development -environment. - ------------------------------------------------------------------------------- -4.1 GNAT ~ - *compiler-gnat* - -GNAT is the only free (beer and speech) Ada compiler available. There are -several version available which differentiate in the licence terms used. - -The GNAT compiler plug-in will perform a compile on pressing <F7> and then -immediately shows the result. You can set the project file to be used by -setting: - > - > call g:gnat.Set_Project_File ('my_project.gpr') - -Setting a project file will also create a Vim session (|views-sessions|) so - -like with the GPS - opened files, window positions etc. will remembered -separately for all projects. - - *gnat_members* -GNAT OBJECT ~ - - *g:gnat.Make()* -g:gnat.Make() - Calls|g:gnat.Make_Command|and displays the result inside a - |quickfix| window. - - *g:gnat.Pretty()* -g:gnat.Pretty() - Calls|g:gnat.Pretty_Command| - - *g:gnat.Find()* -g:gnat.Find() - Calls|g:gnat.Find_Command| - - *g:gnat.Tags()* -g:gnat.Tags() - Calls|g:gnat.Tags_Command| - - *g:gnat.Set_Project_File()* -g:gnat.Set_Project_File([{file}]) - Set gnat project file and load associated session. An open - project will be closed and the session written. If called - without file name the file selector opens for selection of a - project file. If called with an empty string then the project - and associated session are closed. - - *g:gnat.Project_File* -g:gnat.Project_File string - Current project file. - - *g:gnat.Make_Command* -g:gnat.Make_Command string - External command used for|g:gnat.Make()| (|'makeprg'|). - - *g:gnat.Pretty_Program* -g:gnat.Pretty_Program string - External command used for|g:gnat.Pretty()| - - *g:gnat.Find_Program* -g:gnat.Find_Program string - External command used for|g:gnat.Find()| - - *g:gnat.Tags_Command* -g:gnat.Tags_Command string - External command used for|g:gnat.Tags()| - - *g:gnat.Error_Format* -g:gnat.Error_Format string - Error format (|'errorformat'|) - ------------------------------------------------------------------------------- -4.2 Dec Ada ~ - *compiler-hpada* *compiler-decada* - *compiler-vaxada* *compiler-compaqada* - -Dec Ada (also known by - in chronological order - VAX Ada, Dec Ada, Compaq Ada -and HP Ada) is a fairly dated Ada 83 compiler. Support is basic: <F7> will -compile the current unit. - -The Dec Ada compiler expects the package name and not the file name to be -passed a parameter. The compiler plug-in supports the usual file name -convention to convert the file into a unit name. For separates both '-' and -'__' are allowed. - - *decada_members* -DEC ADA OBJECT ~ - - *g:decada.Make()* -g:decada.Make() function - Calls|g:decada.Make_Command|and displays the result inside a - |quickfix| window. - - *g:decada.Unit_Name()* -g:decada.Unit_Name() function - Get the Unit name for the current file. - - *g:decada.Make_Command* -g:decada.Make_Command string - External command used for|g:decadat.Make()| (|'makeprg'|). - - *g:decada.Error_Format* -g:decada.Error_Format| string - Error format (|'errorformat'|). - -============================================================================== -5. References ~ - *ada-reference* - ------------------------------------------------------------------------------- -5.1 Options ~ - *ft-ada-options* - - *g:ada_standard_types* -g:ada_standard_types bool (true when exists) - Highlight types in package Standard (e.g., "Float") - - *g:ada_space_errors* - *g:ada_no_trail_space_error* - *g:ada_no_tab_space_error* - *g:ada_all_tab_usage* -g:ada_space_errors bool (true when exists) - Highlight extraneous errors in spaces ... - g:ada_no_trail_space_error - - but ignore trailing spaces at the end of a line - g:ada_no_tab_space_error - - but ignore tabs after spaces - g:ada_all_tab_usage - - highlight all tab use - - *g:ada_line_errors* -g:ada_line_errors bool (true when exists) - Highlight lines which are to long. Note: This highlighting - option is quite CPU intensive. - - *g:ada_rainbow_color* -g:ada_rainbow_color bool (true when exists) - Use rainbow colours for '(' and ')'. You need the - rainbow_parenthesis for this to work - - *g:ada_folding* -g:ada_folding set ('sigpft') - Use folding for Ada sources. - 's': activate syntax folding on load - 'p': fold packages - 'f': fold functions and procedures - 't': fold types - 'c': fold conditionals - 'g': activate gnat pretty print folding on load - 'i': lone 'is' folded with line above - 'b': lone 'begin' folded with line above - 'p': lone 'private' folded with line above - 'x': lone 'exception' folded with line above - 'i': activate indent folding on load - - Note: Syntax folding is in an early (unusable) stage and - indent or gnat pretty folding is suggested. - - For gnat pretty folding to work the following settings are - suggested: -cl3 -M79 -c2 -c3 -c4 -A1 -A2 -A3 -A4 -A5 - - For indent folding to work the following settings are - suggested: shiftwidth=3 softtabstop=3 - - *g:ada_abbrev* -g:ada_abbrev bool (true when exists) - Add some abbreviations. This feature more or less superseded - by the various completion methods. - - *g:ada_withuse_ordinary* -g:ada_withuse_ordinary bool (true when exists) - Show "with" and "use" as ordinary keywords (when used to - reference other compilation units they're normally highlighted - specially). - - *g:ada_begin_preproc* -g:ada_begin_preproc bool (true when exists) - Show all begin-like keywords using the colouring of C - preprocessor commands. - - *g:ada_omni_with_keywords* -g:ada_omni_with_keywords - Add Keywords, Pragmas, Attributes to omni-completions - (|compl-omni|). Note: You can always complete then with user - completion (|i_CTRL-X_CTRL-U|). - - *g:ada_extended_tagging* -g:ada_extended_tagging enum ('jump', 'list') - use extended tagging, two options are available - 'jump': use tjump to jump. - 'list': add tags quick fix list. - Normal tagging does not support function or operator - overloading as these features are not available in C and - tagging was originally developed for C. - - *g:ada_extended_completion* -g:ada_extended_completion - Uses extended completion for <C-N> and <C-R> completions - (|i_CTRL-N|). In this mode the '.' is used as part of the - identifier so that 'Object.Method' or 'Package.Procedure' are - completed together. - - *g:ada_gnat_extensions* -g:ada_gnat_extensions bool (true when exists) - Support GNAT extensions. - - *g:ada_with_gnat_project_files* -g:ada_with_gnat_project_files bool (true when exists) - Add gnat project file keywords and Attributes. - - *g:ada_default_compiler* -g:ada_default_compiler string - set default compiler. Currently supported is 'gnat' and - 'decada'. - -An "exists" type is a boolean is considered true when the variable is defined -and false when the variable is undefined. The value which the variable is -set makes no difference. - ------------------------------------------------------------------------------- -5.3 Commands ~ - *ft-ada-commands* - -:AdaRainbow *:AdaRainbow* - Toggles rainbow colour (|g:ada_rainbow_color|) mode for - '(' and ')' - -:AdaLines *:AdaLines* - Toggles line error (|g:ada_line_errors|) display - -:AdaSpaces *:AdaSpaces* - Toggles space error (|g:ada_space_errors|) display. - -:AdaTagDir *:AdaTagDir* - Creates tags file for the directory of the current file. - -:AdaTagFile *:AdaTagFile* - Creates tags file for the current file. - -:AdaTypes *:AdaTypes* - Toggles standard types (|g:ada_standard_types|) colour. - -:GnatFind *:GnatFind* - Calls |g:gnat.Find()| - -:GnatPretty *:GnatPretty* - Calls |g:gnat.Pretty()| - -:GnatTags *:GnatTags* - Calls |g:gnat.Tags()| - ------------------------------------------------------------------------------- -5.3 Variables ~ - *ft-ada-variables* - - *g:gnat* -g:gnat object - Control object which manages GNAT compiles. The object - is created when the first Ada source code is loaded provided - that |g:ada_default_compiler|is set to 'gnat'. See|gnat_members| - for details. - - *g:decada* -g:decada object - Control object which manages Dec Ada compiles. The object - is created when the first Ada source code is loaded provided - that |g:ada_default_compiler|is set to 'decada'. See - |decada_members|for details. - ------------------------------------------------------------------------------- -5.4 Constants ~ - *ft-ada-constants* - -All constants are locked. See |:lockvar| for details. - - *g:ada#WordRegex* -g:ada#WordRegex string - Regular expression to search for Ada words - - *g:ada#DotWordRegex* -g:ada#DotWordRegex string - Regular expression to search for Ada words separated by dots. - - *g:ada#Comment* -g:ada#Comment string - Regular expression to search for Ada comments - - *g:ada#Keywords* -g:ada#Keywords list of dictionaries - List of keywords, attributes etc. pp. in the format used by - omni completion. See |complete-items| for details. - - *g:ada#Ctags_Kinds* -g:ada#Ctags_Kinds dictionary of lists - Dictionary of the various kinds of items which the Ada support - for Ctags generates. - ------------------------------------------------------------------------------- -5.2 Functions ~ - *ft-ada-functions* - -ada#Word([{line}, {col}]) *ada#Word()* - Return full name of Ada entity under the cursor (or at given - line/column), stripping white space/newlines as necessary. - -ada#List_Tag([{line}, {col}]) *ada#Listtags()* - List all occurrences of the Ada entity under the cursor (or at - given line/column) inside the quick-fix window - -ada#Jump_Tag ({ident}, {mode}) *ada#Jump_Tag()* - List all occurrences of the Ada entity under the cursor (or at - given line/column) in the tag jump list. Mode can either be - 'tjump' or 'stjump'. - -ada#Create_Tags ({option}) *ada#Create_Tags()* - Creates tag file using Ctags. The option can either be 'file' - for the current file, 'dir' for the directory of the current - file or a file name. - -gnat#Insert_Tags_Header() *gnat#Insert_Tags_Header()* - Adds the tag file header (!_TAG_) informations to the current - file which are missing from the GNAT XREF output. - -ada#Switch_Syntax_Option ({option}) *ada#Switch_Syntax_Option()* - Toggles highlighting options on or off. Used for the Ada menu. - - *gnat#New()* -gnat#New () - Create a new gnat object. See |g:gnat| for details. - - -============================================================================== -8. Extra Plugins ~ - *ada-extra-plugins* - -You can optionally install the following extra plug-in. They work well with Ada -and enhance the ability of the Ada mode.: - -backup.vim - http://www.vim.org/scripts/script.php?script_id=1537 - Keeps as many backups as you like so you don't have to. - -rainbow_parenthsis.vim - http://www.vim.org/scripts/script.php?script_id=1561 - Very helpful since Ada uses only '(' and ')'. - -nerd_comments.vim - http://www.vim.org/scripts/script.php?script_id=1218 - Excellent commenting and uncommenting support for almost any - programming language. - -matchit.vim - http://www.vim.org/scripts/script.php?script_id=39 - '%' jumping for any language. The normal '%' jump only works for '{}' - style languages. The Ada mode will set the needed search patters. - -taglist.vim - http://www.vim.org/scripts/script.php?script_id=273 - Source code explorer sidebar. There is a patch for Ada available. - -The GNU Ada Project distribution (http://gnuada.sourceforge.net) of Vim -contains all of the above. - -============================================================================== -vim: textwidth=78 nowrap tabstop=8 shiftwidth=4 softtabstop=4 noexpandtab -vim: filetype=help encoding=latin1 diff --git a/runtime/doc/sql.txt b/runtime/doc/sql.txt deleted file mode 100644 index 303ebd5bdc..0000000000 --- a/runtime/doc/sql.txt +++ /dev/null @@ -1,763 +0,0 @@ -*sql.txt* For Vim version 7.1. Last change: Wed Apr 26 2006 3:05:33 PM - -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| -4. OMNI SQL Completion |sql-completion| - 4.1 Static mode |sql-completion-static| - 4.2 Dynamic mode |sql-completion-dynamic| - 4.3 Tutorial |sql-completion-tutorial| - 4.3.1 Complete Tables |sql-completion-tables| - 4.3.2 Complete Columns |sql-completion-columns| - 4.3.3 Complete Procedures |sql-completion-procedures| - 4.3.4 Complete Views |sql-completion-views| - 4.4 Completion Customization |sql-completion-customization| - 4.5 SQL Maps |sql-completion-maps| - 4.6 Using with other filetypes |sql-completion-filetypes| - -============================================================================== -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, indices, -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* *postgres* *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. - - -============================================================================== -4. OMNI SQL Completion *sql-completion* - *omni-sql-completion* - -Vim 7 includes a code completion interface and functions which allows plugin -developers to build in code completion for any language. Vim 7 includes -code completion for the SQL language. - -There are two modes to the SQL completion plugin, static and dynamic. The -static mode populates the popups with the data generated from current syntax -highlight rules. The dynamic mode populates the popups with data retrieved -directly from a database. This includes, table lists, column lists, -procedures names and more. - -4.1 Static Mode *sql-completion-static* ---------------- -The static popups created contain items defined by the active syntax rules -while editing a file with a filetype of SQL. The plugin defines (by default) -various maps to help the user refine the list of items to be displayed. -The defaults static maps are: > - imap <buffer> <C-C>a <C-\><C-O>:call sqlcomplete#Map('syntax')<CR><C-X><C-O> - imap <buffer> <C-C>k <C-\><C-O>:call sqlcomplete#Map('sqlKeyword')<CR><C-X><C-O> - imap <buffer> <C-C>f <C-\><C-O>:call sqlcomplete#Map('sqlFunction')<CR><C-X><C-O> - 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 - <C-C>k - Your choice of key map - <C-\><C-O> - Execute one command, return to Insert mode - :call sqlcomplete#Map( - Allows the SQL completion plugin to perform some - housekeeping functions to allow it to be used in - conjunction with other completion plugins. - Indicate which item you want the SQL completion - plugin to complete. - In this case we are asking the plugin to display - items from the syntax highlight group - 'sqlKeyword'. - You can view a list of highlight group names to - choose from by executing the - :syntax list - command while editing a SQL file. - 'sqlKeyword' - Display the items for the sqlKeyword highlight - group - )<CR> - Execute the :let command - <C-X><C-O> - Trigger the standard omni completion key stroke. - Passing in 'sqlKeyword' instructs the SQL - completion plugin to populate the popup with - items from the sqlKeyword highlight group. The - 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 -10 different syntax files for the different dialects of SQL (see section 3 -above, |sql-dialects|). - -Here are some examples of the entries which are pulled from the syntax files: > - All - - Contains the contents of all syntax highlight groups - Statements - - Select, Insert, Update, Delete, Create, Alter, ... - Functions - - Min, Max, Trim, Round, Date, ... - Keywords - - Index, Database, Having, Group, With - Options - - Isolation_level, On_error, Qualify_owners, Fire_triggers, ... - Types - - Integer, Char, Varchar, Date, DateTime, Timestamp, ... - - -4.2 Dynamic Mode *sql-completion-dynamic* ----------------- -Dynamic mode populates the popups with data directly from a database. In -order for the dynamic feature to be enabled you must have the dbext.vim -plugin installed, (http://vim.sourceforge.net/script.php?script_id=356). - -Dynamic mode is used by several features of the SQL completion plugin. -After installing the dbext plugin see the dbext-tutorial for additional -configuration and usage. The dbext plugin allows the SQL completion plugin -to display a list of tables, procedures, views and columns. > - Table List - - All tables for all schema owners - Procedure List - - All stored procedures for all schema owners - View List - - 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): - Table List - <C-C>t - - <C-X><C-O> (the default map assumes tables) - Stored Procedure List - <C-C>p - View List - <C-C>v - Column List - <C-C>c - - Windows platform only - When viewing a popup window displaying the list - of tables, you can press <C-Right>, this will - replace the table currently highlighted with - the column list for that table. - - When viewing a popup window displaying the list - of columns, you can press <C-Left>, this will - replace the column list with the list of tables. - - This allows you to quickly drill down into a - table to view it's columns and back again. - -The SQL completion plugin caches various lists that are displayed in -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* ----------------- - -This tutorial is designed to take you through the common features of the SQL -completion plugin so that: > - a) You gain familiarity with the plugin - b) You are introduced to some of the more common features - c) Show how to customize it to your preferences - d) Demonstrate "Best of Use" of the plugin (easiest way to configure). - -First, create a new buffer: > - :e tutorial.sql - - -Static features ---------------- -To take you through the various lists, simply enter insert mode, hit: - <C-C>s (show SQL statements) -At this point, you can page down through the list until you find "select". -If you are familiar with the item you are looking for, for example you know -the statement begins with the letter "s". You can type ahead (without the -quotes) "se" then press: - <C-Space>t -Assuming |