forked from aniani/vim
updated for version 7.0c03
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 7.0c. Last change: 2006 Mar 26
|
||||
*eval.txt* For Vim version 7.0c. Last change: 2006 Mar 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1501,6 +1501,7 @@ append( {lnum}, {list}) Number append lines {list} below line {lnum}
|
||||
argc() Number number of files in the argument list
|
||||
argidx() Number current index in the argument list
|
||||
argv( {nr}) String {nr} entry of the argument list
|
||||
argv( ) List the argument list
|
||||
browse( {save}, {title}, {initdir}, {default})
|
||||
String put up a file requester
|
||||
browsedir( {title}, {initdir}) String put up a directory requester
|
||||
@@ -1767,7 +1768,7 @@ argidx() The result is the current index in the argument list. 0 is
|
||||
the first file. argc() - 1 is the last one. See |arglist|.
|
||||
|
||||
*argv()*
|
||||
argv({nr}) The result is the {nr}th file in the argument list of the
|
||||
argv([{nr}]) The result is the {nr}th file in the argument list of the
|
||||
current window. See |arglist|. "argv(0)" is the first one.
|
||||
Example: >
|
||||
:let i = 0
|
||||
@@ -1776,7 +1777,9 @@ argv({nr}) The result is the {nr}th file in the argument list of the
|
||||
: exe 'amenu Arg.' . f . ' :e ' . f . '<CR>'
|
||||
: let i = i + 1
|
||||
:endwhile
|
||||
<
|
||||
< Without the {nr} argument a |List| with the whole |arglist| is
|
||||
returned.
|
||||
|
||||
*browse()*
|
||||
browse({save}, {title}, {initdir}, {default})
|
||||
Put up a file requester. This only works when "has("browse")"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*fold.txt* For Vim version 7.0c. Last change: 2005 Sep 10
|
||||
*fold.txt* For Vim version 7.0c. Last change: 2006 Mar 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -109,6 +109,7 @@ level of the previous line.
|
||||
|
||||
There must be no side effects from the expression. The text in the buffer,
|
||||
cursor position, the search patterns, options etc. must not be changed.
|
||||
You can change and restore them if you are careful.
|
||||
|
||||
If there is some error in the expression, or the resulting value isn't
|
||||
recognized, there is no error message and the fold level will be zero.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*indent.txt* For Vim version 7.0c. Last change: 2005 Aug 30
|
||||
*indent.txt* For Vim version 7.0c. Last change: 2006 Mar 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -68,7 +68,7 @@ as follows:
|
||||
"e" if you type the second 'e' for an "else" at the start of a
|
||||
line
|
||||
|
||||
Characters that can precede each key:
|
||||
Characters that can precede each key: *i_CTRL-F*
|
||||
! When a '!' precedes the key, Vim will not insert the key but will
|
||||
instead reindent the current line. This allows you to define a
|
||||
command key for reindenting the current line. CTRL-F is the default
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*insert.txt* For Vim version 7.0c. Last change: 2006 Mar 28
|
||||
*insert.txt* For Vim version 7.0c. Last change: 2006 Mar 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1214,11 +1214,11 @@ are included.
|
||||
CSS *ft-css-omni*
|
||||
|
||||
Complete properties and their appropriate values according to CSS 2.1
|
||||
specification.
|
||||
specification.
|
||||
|
||||
|
||||
HTML and XHTML *ft-html-omni*
|
||||
*ft-xhtml-omni*
|
||||
HTML *ft-html-omni*
|
||||
XHTML *ft-xhtml-omni*
|
||||
|
||||
CTRL-X CTRL-O provides completion of various elements of (X)HTML files. It is
|
||||
designed to support writing of XHTML 1.0 Strict files but will also works for
|
||||
@@ -1239,12 +1239,12 @@ other versions of HTML. Features:
|
||||
- when used after "</" CTRL-X CTRL-O will close the last opened tag
|
||||
|
||||
Note: When used first time completion menu will be shown with little delay
|
||||
- this is time needed for loading of data file.
|
||||
- this is time needed for loading of data file.
|
||||
Note: Completion may fail in badly formatted documents. In such case try to
|
||||
run |:make| command to detect formatting problems.
|
||||
|
||||
|
||||
JAVASCRIPT *ft-javascript-omni*
|
||||
JAVASCRIPT *ft-javascript-omni*
|
||||
|
||||
Completion of most elements of JavaScript language and DOM elements.
|
||||
|
||||
@@ -1260,7 +1260,7 @@ Complete:
|
||||
Completion works in separate JavaScript files (&ft==javascript), inside of
|
||||
<script> tag of (X)HTML and in values of event attributes (including scanning
|
||||
of external files.
|
||||
|
||||
|
||||
DOM compatibility
|
||||
|
||||
At the moment (beginning of 2006) there are two main browsers - MS Internet
|
||||
@@ -1268,11 +1268,11 @@ Explorer and Mozilla Firefox. These two applications are covering over 90% of
|
||||
market. Theoretically standards are created by W3C organisation
|
||||
(http://www.w3c.org) but they are not always followed/implemented.
|
||||
|
||||
IE FF W3C Omni completion ~
|
||||
+/- +/- + + ~
|
||||
+ + - + ~
|
||||
+ - - - ~
|
||||
- + - - ~
|
||||
IE FF W3C Omni completion ~
|
||||
+/- +/- + + ~
|
||||
+ + - + ~
|
||||
+ - - - ~
|
||||
- + - - ~
|
||||
|
||||
Regardless from state of implementation in browsers but if element is defined
|
||||
in standards, completion plugin will place element in suggestion list. When
|
||||
@@ -1280,7 +1280,7 @@ both major engines implemented element, even if this is not in standards it
|
||||
will be suggested. All other elements are not placed in suggestion list.
|
||||
|
||||
|
||||
PHP *ft-php-omni*
|
||||
PHP *ft-php-omni*
|
||||
|
||||
Completion of PHP code requires tags file for completion of data from external
|
||||
files. You should use Exuberant ctags version 5.5.4 or newer. You can find it
|
||||
@@ -1317,15 +1317,15 @@ This uses the current syntax highlighting for completion. It can be used for
|
||||
any filetype and provides a minimal language-sensitive completion.
|
||||
|
||||
To enable syntax code completion you can run: >
|
||||
setlocal omnifunc=syntaxcomplete#Complete
|
||||
setlocal omnifunc=syntaxcomplete#Complete
|
||||
|
||||
You can automate this by placing the following in your vimrc (after any
|
||||
":filetype" command): >
|
||||
if has("autocmd") && exists("+omnifunc")
|
||||
autocmd Filetype *
|
||||
\ if &omnifunc == "" |
|
||||
\ setlocal omnifunc=syntaxcomplete#Complete |
|
||||
\ endif
|
||||
autocmd Filetype *
|
||||
\ if &omnifunc == "" |
|
||||
\ setlocal omnifunc=syntaxcomplete#Complete |
|
||||
\ endif
|
||||
endif
|
||||
|
||||
The above will set completion to this script only if a specific plugin does
|
||||
@@ -1368,6 +1368,14 @@ You can create as many of these variables as you need, varying only the
|
||||
filetype at the end of the variable name.
|
||||
|
||||
|
||||
SQL *ft-sql-omni*
|
||||
|
||||
Completion for the SQL language includes statements, functions, keywords.
|
||||
It will also dynamically complete tables, procedures, views and column lists
|
||||
with data pulled directly from within a database. For detailed instructions
|
||||
and a tutorial see |omni-sql-completion|.
|
||||
|
||||
|
||||
XML *ft-xml-omni*
|
||||
|
||||
Vim 7 provides mechanism to context aware completion of XML files. It depends
|
||||
@@ -1394,9 +1402,9 @@ which will not create conflicts in future. For example name xhtml10s.vim means
|
||||
it is data file for XHTML 1.0 Strict.
|
||||
|
||||
File contains one variable with fixed name: g:xmldata_xhtml10s . It is
|
||||
compound from two parts:
|
||||
compound from two parts:
|
||||
|
||||
1. "g:xmldata_" general prefix
|
||||
1. "g:xmldata_" general prefix
|
||||
2. "xhtml10s" name of file and name of described XML dialect
|
||||
|
||||
Part two must be exactly the same as name of file.
|
||||
@@ -1407,14 +1415,14 @@ of possible children, second element is |Dictionary| with names of attributes
|
||||
as keys and possible values of attributes as values. Example: >
|
||||
|
||||
let g:xmldata_crippledhtml = {
|
||||
\ "html":
|
||||
\ [ ["body", "head"], {"id": [], "xmlns": ["http://www.w3.org/1999/xhtml"],
|
||||
\ "lang": [], "xml:lang": [], "dir": ["ltr", "rtl"]}],
|
||||
\ "script":
|
||||
\ [ [], {"id": [], "charset": [], "type": ["text/javascript"], "src": [],
|
||||
\ "html":
|
||||
\ [ ["body", "head"], {"id": [], "xmlns": ["http://www.w3.org/1999/xhtml"],
|
||||
\ "lang": [], "xml:lang": [], "dir": ["ltr", "rtl"]}],
|
||||
\ "script":
|
||||
\ [ [], {"id": [], "charset": [], "type": ["text/javascript"], "src": [],
|
||||
\ "defer": ["BOOL"], "xml:space": ["preserve"]}],
|
||||
\ "meta":
|
||||
\ [ [], {"id": [], "http-equiv": [], "name": [], "content": [], "scheme":
|
||||
\ "meta":
|
||||
\ [ [], {"id": [], "http-equiv": [], "name": [], "content": [], "scheme":
|
||||
\ [], "lang": [], "xml:lang": [], "dir": ["ltr", "rtl"]}]
|
||||
\ "vimxmlentities": ["amp", "lt", "gt", "apos", "quot"]},
|
||||
\ "vimxmltaginfo": {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*mbyte.txt* For Vim version 7.0c. Last change: 2006 Mar 05
|
||||
*mbyte.txt* For Vim version 7.0c. Last change: 2006 Mar 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar et al.
|
||||
@@ -1076,6 +1076,7 @@ also add this line: >
|
||||
'' '
|
||||
Since the mapping is defined with |:lnoremap| the resulting quote will not be
|
||||
used for the start of another character.
|
||||
The "accents" keymap uses this. *keymap-accents*
|
||||
|
||||
Although it's possible to have more than one character in the second column,
|
||||
this is unusual. But you can use various ways to specify the character: >
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*options.txt* For Vim version 7.0c. Last change: 2006 Mar 26
|
||||
*options.txt* For Vim version 7.0c. Last change: 2006 Mar 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -2077,6 +2077,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
Highlight the screen line of the cursor with CursorLine
|
||||
|hl-CursorLine|. Useful to easily spot the cursor. Will make screen
|
||||
redrawing slower.
|
||||
When Visual mode is active the highlighting isn't used to make it
|
||||
easier to spot where the selected area.
|
||||
|
||||
|
||||
*'debug'*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*os_mac.txt* For Vim version 7.0c. Last change: 2006 Mar 26
|
||||
*os_mac.txt* For Vim version 7.0c. Last change: 2006 Mar 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar et al.
|
||||
@@ -86,6 +86,14 @@ A: Assuming that Vim.app is located in /Applications:
|
||||
Or:
|
||||
/Applications/Vim.app/Contents/MacOS/Vim -g {arguments}
|
||||
|
||||
Q: How can I set $PATH to something reasonable when I start Vim.app from the
|
||||
GUI or with open?
|
||||
A: The following trick works with most shells. Put it in your vimrc file.
|
||||
This is included in the system vimrc file included with the binaries
|
||||
distributed at macvim.org . >
|
||||
let s:path = system("echo echo VIMPATH'${PATH}' | $SHELL -l")
|
||||
let $PATH = matchstr(s:path, 'VIMPATH\zs.\{-}\ze\n')
|
||||
|
||||
==============================================================================
|
||||
4. Mac Lack *mac-lack*
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*pi_paren.txt* For Vim version 7.0c. Last change: 2006 Mar 24
|
||||
*pi_paren.txt* For Vim version 7.0c. Last change: 2006 Mar 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -38,5 +38,9 @@ in a string or comment syntax item, then matches inside string and comment
|
||||
syntax items are ignored. Any syntax items with "string" or "comment"
|
||||
somewhere in their name are considered string or comment items.
|
||||
|
||||
The search is limited to what is visible in the window. The plugin doesn't
|
||||
search further than 100 lines to avoid a long delay when there are closed
|
||||
folds.
|
||||
|
||||
==============================================================================
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*sponsor.txt* For Vim version 7.0c. Last change: 2006 Mar 24
|
||||
*sponsor.txt* For Vim version 7.0c. Last change: 2006 Mar 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -13,7 +13,7 @@ working on Vim please send a donation.
|
||||
|
||||
Since Bram is back to a paid job the money will now be used to help children
|
||||
in Uganda. See |uganda|. But at the same time donations increase Bram's
|
||||
motivation to work on Vim!
|
||||
motivation to keep working on Vim!
|
||||
|
||||
For the most recent information about sponsoring look on the Vim web site:
|
||||
|
||||
@@ -93,7 +93,7 @@ QUESTIONS AND ANSWERS *sponsor-faq* *register-faq*
|
||||
Why should I give money?
|
||||
|
||||
If you do not show your appreciation for Vim then Bram will be less motivated
|
||||
to fix bugs and add new features.
|
||||
to fix bugs and add new features. He will do something else instead.
|
||||
|
||||
|
||||
How much money should I send?
|
||||
@@ -177,6 +177,12 @@ You can change your votes any time you like, up to two years after you
|
||||
sent money. The points will be counted right away.
|
||||
|
||||
|
||||
Can I add an item to vote on?
|
||||
|
||||
Not directly. You can suggest items to vote on to Bram. He will consider
|
||||
fitting your item into the list.
|
||||
|
||||
|
||||
How about Charityware?
|
||||
|
||||
Currently the Vim donations go to |uganda| anyway. Thus it doesn't matter if
|
||||
@@ -202,7 +208,9 @@ let him know that the donation is done because of the use of Vim.
|
||||
|
||||
Can you send me a bill?
|
||||
|
||||
No. But a receipt is possible.
|
||||
No, because there is no relation between the money you send and the work that
|
||||
is done. But a receipt is possible.
|
||||
|
||||
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*sql.txt* For Vim version 7.0c. Last change: Fri Jan 06 2006 8:09:25 AM
|
||||
*sql.txt* For Vim version 7.0c. Last change: Tue Mar 28 2006 9:33:14 PM
|
||||
|
||||
by David Fishburn
|
||||
|
||||
@@ -17,6 +17,16 @@ features for navigation, indentation and syntax highlighting.
|
||||
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 Customizing Maps |sql-completion-maps|
|
||||
|
||||
==============================================================================
|
||||
1. Navigation *sql-navigation*
|
||||
@@ -89,7 +99,7 @@ file): >
|
||||
|
||||
1.3 Predefined Object Motions *sql-predefined-objects*
|
||||
-----------------------------
|
||||
Most relational databases support various standard features, tables, indicies,
|
||||
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
|
||||
@@ -293,6 +303,333 @@ 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 which list of items they wish displayed.
|
||||
The defaults static maps are: >
|
||||
imap <buffer> <C-C>a <C-\><C-O>:let b:sql_compl_type='syntax'<CR><C-X><C-O>
|
||||
imap <buffer> <C-C>s <C-\><C-O>:let b:sql_compl_type='sqlStatement'<CR><C-X><C-O>
|
||||
imap <buffer> <C-C>f <C-\><C-O>:let b:sql_compl_type='sqlFunction'<CR><C-X><C-O>
|
||||
imap <buffer> <C-C>k <C-\><C-O>:let b:sql_compl_type='sqlKeyword'<CR><C-X><C-O>
|
||||
imap <buffer> <C-C>o <C-\><C-O>:let b:sql_compl_type='sqlOption'<CR><C-X><C-O>
|
||||
imap <buffer> <C-C>T <C-\><C-O>:let b:sql_compl_type='sqlType'<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>:let b:sql_compl_type='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
|
||||
:let b:sql_compl_type= - Choose the highlight group's entries to display.
|
||||
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.
|
||||
By setting the b:sql_compl_type variable, this
|
||||
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.
|
||||
<
|
||||
Setting b:sql_compl_type = 'syntax' 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
|
||||
- .<C-X><C-O>
|
||||
- If <C-X><C-O> is pressed following a period
|
||||
it is assumed you are asking for a column list.
|
||||
- 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.
|
||||
|
||||
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-O>:let b:sql_compl_type='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-Spact>t
|
||||
Assuming "select" is highlighted in the popup list press <Enter> to choose
|
||||
the entry. Now type:
|
||||
* fr<C-C>a (show all syntax items)
|
||||
choose "from" from the popup list.
|
||||
|
||||
When writing stored procedures using the "type" list is useful. It contains
|
||||
a list of all the database supported types. This may or may not be true
|
||||
depending on the syntax file you are using. The SQL Anywhere syntax file
|
||||
(sqlanywhere.vim) has support for this: >
|
||||
BEGIN
|
||||
DECLARE customer_id <C-C>T <-- Choose a type from the list
|
||||
<
|
||||
|
||||
Dynamic features
|
||||
----------------
|
||||
To take advantage of the dynamic features you must first install the
|
||||
dbext.vim plugin (http://vim.sourceforge.net/script.php?script_id=356). It
|
||||
also comes with a tutorial. From the SQL completion plugin's perspective,
|
||||
the main feature dbext provides is a connection to a database. dbext
|
||||
connection profiles are the most efficient mechanism to define connection
|
||||
information. Once connections have been setup, the SQL completion plugin
|
||||
uses the features of dbext in the background to populate the popups.
|
||||
|
||||
What follows assumes dbext.vim has been correctly configured, a simple test
|
||||
is to run the command, :DBListTable. If a list of tables is shown, you know
|
||||
dbext.vim is working as expected. If not, please consult the dbext.txt
|
||||
documentation.
|
||||
|
||||
Assuming you have followed the |dbext-tutorial| you can press <C-C>t to
|
||||
display a list of tables. There is a delay while dbext is creating the table
|
||||
list. After the list is displayed press <C-W>. This will remove both the
|
||||
popup window and the table name already chosen when the list became active. >
|
||||
|
||||
4.3.1 Table Completion: *sql-completion-tables*
|
||||
<
|
||||
Press <C-C>t to display a list of tables from within the database you
|
||||
have connected via the dbext plugin.
|
||||
NOTE: All of the SQL completion popups support typing a prefix before pressing
|
||||
the key map. This will limit the contents of the popup window to just items
|
||||
beginning with those characters. >
|
||||
|
||||
4.3.2 Column Completion: *sql-completion-columns*
|
||||
<
|
||||
The SQL completion plugin can also display a list of columns for particular
|
||||
tables. The column completion is trigger via <C-C>c.
|
||||
|
||||
NOTE: The following example uses <C-Right> to trigger a column list while
|
||||
the popup window is active. This map is only available on the Windows
|
||||
platforms since *nix does not recognize CTRL and the right arrow held down
|
||||
together. If you wish to enable this functionality on a *nix platform choose
|
||||
a key and create this mapping (see |sql-completion-maps| for further
|
||||
details on where to create this imap): >
|
||||
imap <buffer> <your_keystroke> <CR><C-\><C-O>:let b:sql_compl_type='column'<CR><C-X><C-O>
|
||||
<
|
||||
Example of using column completion:
|
||||
- Press <C-C>t again to display the list of tables.
|
||||
- When the list is displayed in the completion window, press <C-Right>,
|
||||
this will replace the list of tables, with a list of columns for the
|
||||
table highlighted (after the same short delay).
|
||||
- If you press <C-Left>, this will again replace the column list with the
|
||||
list of tables. This allows you to drill into tables and column lists
|
||||
very quickly.
|
||||
- Press <C-Right> again while the same table is highlighted. You will
|
||||
notice there is no delay since the column list has been cached. If you
|
||||
change the schema of a cached table you can press <C-C>R, which
|
||||
clears the SQL completion cache.
|
||||
- NOTE: <C-Right> and <C-Left> have been designed to work while the
|
||||
completion window is active. If you use these maps when the completion
|
||||
window is not active a carriage return will be inadvertently entered in
|
||||
your buffer.
|
||||
|
||||
Lets look how we can build a SQL statement dynamically. A select statement
|
||||
requires a list of columns. There are two ways to build a column list using
|
||||
the SQL completion plugin. >
|
||||
One column at a time:
|
||||
< 1. After typing SELECT press <C-C>t to display a list of tables.
|
||||
2. Choose a table from the list.
|
||||
3. Press <C-Right> to display a list of columns.
|
||||
4. Choose the column from the list and press enter.
|
||||
5. Enter a "," and press <C-C>c. Generating a column list
|
||||
generally requires having the cursor on a table name. The plugin
|
||||
uses this name to determine what table to retrieve the column list.
|
||||
In this step, since we are pressing <C-C>c without the cursor
|
||||
on a table name the column list displayed will be for the previous
|
||||
table. Choose a different column and move on.
|
||||
6. Repeat step 5 as often as necessary. >
|
||||
All columns for a table:
|
||||
< 1. After typing SELECT press <C-C>t to display a list of tables.
|
||||
2. Highlight the table you need the column list for.
|
||||
3. Press <Enter> to choose the table from the list.
|
||||
4. Press <C-C>l to request a comma separated list of all columns
|
||||
for this table.
|
||||
5. Based on the table name chosen in step 3, the plugin attempts to
|
||||
decide on a reasonable table alias. You are then prompted to
|
||||
either accept of change the alias. Press OK.
|
||||
6. The table name is replaced with the column list of the table is
|
||||
replaced with the comma separate list of columns with the alias
|
||||
prepended to each of the columns.
|
||||
7. Step 3 and 4 can be replaced by pressing <C-C>L, which has
|
||||
a <CR> embedded in the map to choose the currently highlighted
|
||||
table in the list.
|
||||
|
||||
There is a special provision when writing select statements. Consider the
|
||||
following statement: >
|
||||
select *
|
||||
from customer c,
|
||||
contact cn,
|
||||
department as dp,
|
||||
employee e,
|
||||
site_options so
|
||||
where c.
|
||||
<
|
||||
In INSERT mode after typing the final "c." which is an alias for the
|
||||
"customer" table, you can press either <C-C>c or <C-X><C-O>. This will
|
||||
popup a list of columns for the customer table. It does this by looking back
|
||||
to the beginning of the select statement and finding a list of the tables
|
||||
specified in the FROM clause. In this case it notes that in the string
|
||||
"customer c", "c" is an alias for the customer table. The optional "AS"
|
||||
keyword is also supported, "customer AS c". >
|
||||
|
||||
|
||||
4.3.3 Procedure Completion: *sql-completion-procedures*
|
||||
<
|
||||
Similar to the table list, <C-C>p, will display a list of stored
|
||||
procedures stored within the database. >
|
||||
|
||||
4.3.4 View Completion: *sql-completion-views*
|
||||
<
|
||||
Similar to the table list, <C-C>v, will display a list of views in the
|
||||
database.
|
||||
|
||||
|
||||
4.4 Completion Customization *sql-completion-customization*
|
||||
----------------------------
|
||||
|
||||
The SQL completion plugin can be customized through various options set in
|
||||
your |vimrc|: >
|
||||
omni_sql_no_default_maps
|
||||
< - Default: This variable is not defined
|
||||
- If this variable is defined, no maps are created for OMNI
|
||||
completion. See |sql-completion-maps| for further discussion.
|
||||
>
|
||||
omni_sql_use_tbl_alias
|
||||
< - Default: a
|
||||
- This setting is only used when generating a comma separated
|
||||
column list. By default the map is <C-C>l. When generating
|
||||
a column list, an alias can be prepended to the beginning of each
|
||||
column, for example: e.emp_id, e.emp_name. This option has three
|
||||
settings: >
|
||||
n - do not use an alias
|
||||
d - use the default (calculated) alias
|
||||
a - ask to confirm the alias name
|
||||
<
|
||||
An alias is determined following a few rules:
|
||||
1. If the table name has an '_', then use it as a separator: >
|
||||
MY_TABLE_NAME --> MTN
|
||||
my_table_name --> mtn
|
||||
My_table_NAME --> MtN
|
||||
< 2. If the table name does NOT contain an '_', but DOES use
|
||||
mixed case then the case is used as a separator: >
|
||||
MyTableName --> MTN
|
||||
< 3. If the table name does NOT contain an '_', and does NOT
|
||||
use mixed case then the first letter of the table is used: >
|
||||
mytablename --> m
|
||||
MYTABLENAME --> M
|
||||
<
|
||||
|
||||
4.5 Customizing Maps *sql-completion-maps*
|
||||
--------------------
|
||||
|
||||
You can create as many additional key maps as you like. Generally, the maps
|
||||
will be specifying different syntax highlight groups.
|
||||
|
||||
If you do not wish the default maps created or the key choices do not work on
|
||||
your platform (often a case on *nix) you define the following variable in
|
||||
your |vimrc|: >
|
||||
let g:omni_sql_no_default_maps = 1
|
||||
<
|
||||
Do no edit ftplugin/sql.vim directly! If you change this file your changes
|
||||
will be over written on future updates. Vim has a special directory structure
|
||||
that allows you to make customizations without changing the files that are
|
||||
included with the Vim distribution. If you wish to customize the maps
|
||||
create an after/ftplugin/sql.vim (see |after-directory|) and place the same
|
||||
maps from the ftplugin/sql.vim in it using your own key strokes. <C-C> was
|
||||
chosen since it will work on both Windows and *nix platforms. On the windows
|
||||
platform you can also use <C-Space> or ALT keys.
|
||||
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
|
||||
@@ -5307,6 +5307,7 @@ ft-sh-syntax syntax.txt /*ft-sh-syntax*
|
||||
ft-spec-plugin filetype.txt /*ft-spec-plugin*
|
||||
ft-spup-syntax syntax.txt /*ft-spup-syntax*
|
||||
ft-sql filetype.txt /*ft-sql*
|
||||
ft-sql-omni insert.txt /*ft-sql-omni*
|
||||
ft-sql-syntax syntax.txt /*ft-sql-syntax*
|
||||
ft-sqlanywhere-syntax syntax.txt /*ft-sqlanywhere-syntax*
|
||||
ft-sqlinformix-syntax syntax.txt /*ft-sqlinformix-syntax*
|
||||
@@ -5746,6 +5747,7 @@ i_CTRL-B-gone version5.txt /*i_CTRL-B-gone*
|
||||
i_CTRL-C insert.txt /*i_CTRL-C*
|
||||
i_CTRL-D insert.txt /*i_CTRL-D*
|
||||
i_CTRL-E insert.txt /*i_CTRL-E*
|
||||
i_CTRL-F indent.txt /*i_CTRL-F*
|
||||
i_CTRL-G_<Down> insert.txt /*i_CTRL-G_<Down>*
|
||||
i_CTRL-G_<Up> insert.txt /*i_CTRL-G_<Up>*
|
||||
i_CTRL-G_CTRL-J insert.txt /*i_CTRL-G_CTRL-J*
|
||||
@@ -5916,6 +5918,7 @@ key-mapping map.txt /*key-mapping*
|
||||
key-notation intro.txt /*key-notation*
|
||||
key-variable eval.txt /*key-variable*
|
||||
keycodes intro.txt /*keycodes*
|
||||
keymap-accents mbyte.txt /*keymap-accents*
|
||||
keymap-file-format mbyte.txt /*keymap-file-format*
|
||||
keymap-hebrew mbyte.txt /*keymap-hebrew*
|
||||
keypad-0 intro.txt /*keypad-0*
|
||||
@@ -6386,6 +6389,7 @@ ole-normal if_ole.txt /*ole-normal*
|
||||
ole-registration if_ole.txt /*ole-registration*
|
||||
ole-sendkeys if_ole.txt /*ole-sendkeys*
|
||||
ole-setforeground if_ole.txt /*ole-setforeground*
|
||||
omni-sql-completion sql.txt /*omni-sql-completion*
|
||||
online-help various.txt /*online-help*
|
||||
opening-window windows.txt /*opening-window*
|
||||
operator motion.txt /*operator*
|
||||
@@ -6905,6 +6909,16 @@ sponsor.txt sponsor.txt /*sponsor.txt*
|
||||
spoon os_unix.txt /*spoon*
|
||||
spup.vim syntax.txt /*spup.vim*
|
||||
sql-adding-dialects sql.txt /*sql-adding-dialects*
|
||||
sql-completion sql.txt /*sql-completion*
|
||||
sql-completion-columns sql.txt /*sql-completion-columns*
|
||||
sql-completion-customization sql.txt /*sql-completion-customization*
|
||||
sql-completion-dynamic sql.txt /*sql-completion-dynamic*
|
||||
sql-completion-maps sql.txt /*sql-completion-maps*
|
||||
sql-completion-procedures sql.txt /*sql-completion-procedures*
|
||||
sql-completion-static sql.txt /*sql-completion-static*
|
||||
sql-completion-tables sql.txt /*sql-completion-tables*
|
||||
sql-completion-tutorial sql.txt /*sql-completion-tutorial*
|
||||
sql-completion-views sql.txt /*sql-completion-views*
|
||||
sql-dialects sql.txt /*sql-dialects*
|
||||
sql-macros sql.txt /*sql-macros*
|
||||
sql-matchit sql.txt /*sql-matchit*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*todo.txt* For Vim version 7.0c. Last change: 2006 Mar 28
|
||||
*todo.txt* For Vim version 7.0c. Last change: 2006 Mar 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -30,10 +30,7 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
|
||||
*known-bugs*
|
||||
-------------------- Known bugs and current work -----------------------
|
||||
|
||||
The 16 bit DOS version compiles now, but it's still too low on memory, writing
|
||||
a file fails when 'writebackup' is set.
|
||||
|
||||
Have argv() return the arguments in a List.
|
||||
When "search" is in 'foldopen' have [s and ]s open folds.
|
||||
|
||||
New Hungarian dictionary. (Laci Nemeth)
|
||||
test COMPOUNDFORBIDFLAG
|
||||
@@ -49,9 +46,6 @@ New Hungarian dictionary. (Laci Nemeth)
|
||||
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.
|
||||
|
||||
Add more tests for all new functionality in Vim 7. Especially new functions.
|
||||
|
||||
@@ -461,7 +455,8 @@ MSDOS/DJGPP:
|
||||
8 DJGPP: "cd c:" can take us to a directory that no longer exists.
|
||||
change_drive() doesn't check this. How to check for this error?
|
||||
9 The 16 bit version runs out of memory very quickly. Should find unused
|
||||
code and reduce static data.
|
||||
code and reduce static data. Resetting 'writebackup' helps to be able to
|
||||
write a file.
|
||||
9 Crash when running on Windows 98 in a console window and pressing CTRL-C.
|
||||
Happens now and then. When debugging Vim in gdb this also happens. Since
|
||||
the console crashes, might be a bug in the DOS console. Resetting
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*version7.txt* For Vim version 7.0c. Last change: 2006 Mar 28
|
||||
*version7.txt* For Vim version 7.0c. Last change: 2006 Mar 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -692,6 +692,7 @@ New and extended functions: ~
|
||||
|
||||
|add()| append an item to a List
|
||||
|append()| append List of lines to the buffer
|
||||
|argv()| without an argument return the whole argument list
|
||||
|browsedir()| dialog to select a directory
|
||||
|bufnr()| takes an extra argument: create buffer
|
||||
|byteidx()| index of a character (Ilya Sher)
|
||||
@@ -2239,4 +2240,19 @@ text.
|
||||
GUI: When there are left and righ scrollbars, ":tabedit" kept them instead of
|
||||
using the one that isn't needed.
|
||||
|
||||
Using "gP" to replace al the text could leave the cursor below the last line,
|
||||
causing ml_get errors.
|
||||
|
||||
When 'cursorline' is set don't use the highlighting when Visual mode is
|
||||
active, otherwise it's difficult to see the selected area.
|
||||
|
||||
The matchparen plugin restricts the search to 100 lines, to avoid a long delay
|
||||
when there are closed folds.
|
||||
|
||||
Sometimes using CTRL-X s to list spelling suggestions used text from another
|
||||
line.
|
||||
|
||||
Win32: Set the default for 'isprint' back to the wrong default "@,~-255",
|
||||
because many people use Windows-1252 while 'encoding' is "latin1".
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
|
||||
Reference in New Issue
Block a user