annotate runtime/ftplugin/sql.vim @ 7888:8ab9a34a0ec5

Added tag v7.4.1240 for changeset a98b93736894e596c27611feeacce86ca5731b5f
author Christian Brabandt <cb@256bit.org>
date Tue, 02 Feb 2016 19:00:07 +0100
parents eb6ab7e78925
children d0a20101ecb2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
1 " SQL filetype plugin file
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
2 " Language: SQL (Common for Oracle, Microsoft SQL Server, Sybase)
4437
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3996
diff changeset
3 " Version: 11.0
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2458
diff changeset
4 " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
4437
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3996
diff changeset
5 " Last Change: 2013 May 13
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
6 " Download: http://vim.sourceforge.net/script.php?script_id=454
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
8 " For more details please use:
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
9 " :h sql.txt
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
10 "
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 " This file should only contain values that are common to all SQL languages
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 " Oracle, Microsoft SQL Server, Sybase ASA/ASE, MySQL, and so on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 " If additional features are required create:
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
14 " vimfiles/after/ftplugin/sql.vim (Windows)
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
15 " .vim/after/ftplugin/sql.vim (Unix)
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
16 " to override and add any of your own settings.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
18
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
19 " This file also creates a command, SQLSetType, which allows you to change
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
20 " SQL dialects on the fly. For example, if I open an Oracle SQL file, it
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
21 " is color highlighted appropriately. If I open an Informix SQL file, it
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
22 " will still be highlighted according to Oracles settings. By running:
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
23 " :SQLSetType sqlinformix
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
24 "
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
25 " All files called sqlinformix.vim will be loaded from the indent and syntax
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
26 " directories. This allows you to easily flip SQL dialects on a per file
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
27 " basis. NOTE: you can also use completion:
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
28 " :SQLSetType <tab>
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
29 "
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
30 " To change the default dialect, add the following to your vimrc:
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
31 " let g:sql_type_default = 'sqlanywhere'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
32 "
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
33 " This file also creates a command, SQLGetType, which allows you to
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
34 " determine what the current dialect is in use.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
35 " :SQLGetType
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
36 "
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
37 " History
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
38 "
4437
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3996
diff changeset
39 " Version 11.0 (May 2013)
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3996
diff changeset
40 "
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3996
diff changeset
41 " NF: Updated to use SyntaxComplete's new regex support for syntax groups.
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3996
diff changeset
42 "
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
43 " Version 10.0 (Dec 2012)
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
44 "
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
45 " NF: Changed all maps to use noremap instead of must map
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
46 " NF: Changed all visual maps to use xnoremap instead of vnoremap as they
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
47 " should only be used in visual mode and not select mode.
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
48 " BF: Most of the maps were using doubled up backslashes before they were
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
49 " changed to using the search() function, which meant they no longer
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
50 " worked.
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
51 "
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
52 " Version 9.0
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
53 "
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
54 " NF: Completes 'b:undo_ftplugin'
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
55 " BF: Correctly set cpoptions when creating script
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
56 "
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2458
diff changeset
57 " Version 8.0
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
58 "
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2458
diff changeset
59 " NF: Improved the matchit plugin regex (Talek)
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2458
diff changeset
60 "
2458
22a6f99e6477 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
61 " Version 7.0
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
62 "
2458
22a6f99e6477 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
63 " NF: Calls the sqlcomplete#ResetCacheSyntax() function when calling
22a6f99e6477 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
64 " SQLSetType.
22a6f99e6477 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
65 "
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
66 " Version 6.0
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
67 "
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
68 " NF: Adds the command SQLGetType
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
69 "
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
70 " Version 5.0
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
71 "
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
72 " NF: Adds the ability to choose the keys to control SQL completion, just add
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
73 " the following to your .vimrc:
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
74 " let g:ftplugin_sql_omni_key = '<C-C>'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
75 " let g:ftplugin_sql_omni_key_right = '<Right>'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
76 " let g:ftplugin_sql_omni_key_left = '<Left>'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
77 "
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
78 " BF: format-options - Auto-wrap comments using textwidth was turned off
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
79 " by mistake.
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
80
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
81
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 " Only do this when not done yet for this buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 if exists("b:did_ftplugin")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
87 let s:save_cpo = &cpo
3526
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3410
diff changeset
88 set cpo&vim
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
89
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 844
diff changeset
90 " Disable autowrapping for code, but enable for comments
73fe8baea242 updated for version 7.2a
vimboss
parents: 844
diff changeset
91 " t Auto-wrap text using textwidth
73fe8baea242 updated for version 7.2a
vimboss
parents: 844
diff changeset
92 " c Auto-wrap comments using textwidth, inserting the current comment
73fe8baea242 updated for version 7.2a
vimboss
parents: 844
diff changeset
93 " leader automatically.
73fe8baea242 updated for version 7.2a
vimboss
parents: 844
diff changeset
94 setlocal formatoptions-=t
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
95 setlocal formatoptions+=c
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 844
diff changeset
96
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
97 " Functions/Commands to allow the user to change SQL syntax dialects
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
98 " through the use of :SQLSetType <tab> for completion.
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
99 " This works with both Vim 6 and 7.
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
100
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
101 if !exists("*SQL_SetType")
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
102 " NOTE: You cannot use function! since this file can be
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
103 " sourced from within this function. That will result in
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
104 " an error reported by Vim.
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
105 function SQL_GetList(ArgLead, CmdLine, CursorPos)
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
106
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
107 if !exists('s:sql_list')
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
108 " Grab a list of files that contain "sql" in their names
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
109 let list_indent = globpath(&runtimepath, 'indent/*sql*')
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
110 let list_syntax = globpath(&runtimepath, 'syntax/*sql*')
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
111 let list_ftplugin = globpath(&runtimepath, 'ftplugin/*sql*')
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
112
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
113 let sqls = "\n".list_indent."\n".list_syntax."\n".list_ftplugin."\n"
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
114
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
115 " Strip out everything (path info) but the filename
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
116 " Regex
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
117 " From between two newline characters
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
118 " Non-greedily grab all characters
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
119 " Followed by a valid filename \w\+\.\w\+ (sql.vim)
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
120 " Followed by a newline, but do not include the newline
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
121 "
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
122 " Replace it with just the filename (get rid of PATH)
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
123 "
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
124 " Recursively, since there are many filenames that contain
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
125 " the word SQL in the indent, syntax and ftplugin directory
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
126 let sqls = substitute( sqls,
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
127 \ '[\n]\%(.\{-}\)\(\w\+\.\w\+\)\n\@=',
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
128 \ '\1\n',
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
129 \ 'g'
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
130 \ )
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
131
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
132 " Remove duplicates, since sqlanywhere.vim can exist in the
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
133 " sytax, indent and ftplugin directory, yet we only want
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
134 " to display the option once
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
135 let index = match(sqls, '.\{-}\ze\n')
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
136 while index > -1
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
137 " Get the first filename
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
138 let file = matchstr(sqls, '.\{-}\ze\n', index)
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
139 " Recursively replace any *other* occurrence of that
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
140 " filename with nothing (ie remove it)
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
141 let sqls = substitute(sqls, '\%>'.(index+strlen(file)).'c\<'.file.'\>\n', '', 'g')
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
142 " Move on to the next filename
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
143 let index = match(sqls, '.\{-}\ze\n', (index+strlen(file)+1))
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
144 endwhile
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
145
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
146 " Sort the list if using version 7
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
147 if v:version >= 700
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
148 let mylist = split(sqls, "\n")
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
149 let mylist = sort(mylist)
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
150 let sqls = join(mylist, "\n")
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
151 endif
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
152
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
153 let s:sql_list = sqls
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
154 endif
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
155
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
156 return s:sql_list
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
157
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
158 endfunction
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
159
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
160 function SQL_SetType(name)
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
161
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
162 " User has decided to override default SQL scripts and
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
163 " specify a vendor specific version
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
164 " (ie Oracle, Informix, SQL Anywhere, ...)
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
165 " So check for an remove any settings that prevent the
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
166 " scripts from being executed, and then source the
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
167 " appropriate Vim scripts.
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
168 if exists("b:did_ftplugin")
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
169 unlet b:did_ftplugin
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
170 endif
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
171 if exists("b:current_syntax")
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
172 " echomsg 'SQLSetType - clearing syntax'
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
173 syntax clear
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
174 endif
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
175 if exists("b:did_indent")
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
176 " echomsg 'SQLSetType - clearing indent'
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
177 unlet b:did_indent
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
178 " Set these values to their defaults
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
179 setlocal indentkeys&
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
180 setlocal indentexpr&
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
181 endif
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
182
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
183 " Ensure the name is in the correct format
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
184 let new_sql_type = substitute(a:name,
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
185 \ '\s*\([^\.]\+\)\(\.\w\+\)\?', '\L\1', '')
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
186
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
187 " Do not specify a buffer local variable if it is
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
188 " the default value
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
189 if new_sql_type == 'sql'
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
190 let new_sql_type = 'sqloracle'
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
191 endif
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
192 let b:sql_type_override = new_sql_type
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
193
2458
22a6f99e6477 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
194 " Remove any cached SQL since a new sytax will have different
22a6f99e6477 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
195 " items and groups
4437
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3996
diff changeset
196 if !exists('g:loaded_sql_completion') || g:loaded_sql_completion >= 100
2458
22a6f99e6477 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
197 call sqlcomplete#ResetCacheSyntax()
22a6f99e6477 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
198 endif
22a6f99e6477 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
199
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
200 " Vim will automatically source the correct files if we
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
201 " change the filetype. You cannot do this with setfiletype
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
202 " since that command will only execute if a filetype has
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
203 " not already been set. In this case we want to override
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
204 " the existing filetype.
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
205 let &filetype = 'sql'
2458
22a6f99e6477 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
206
22a6f99e6477 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
207 if b:sql_compl_savefunc != ""
22a6f99e6477 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
208 " We are changing the filetype to SQL from some other filetype
22a6f99e6477 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
209 " which had OMNI completion defined. We need to activate the
22a6f99e6477 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
210 " SQL completion plugin in order to cache some of the syntax items
22a6f99e6477 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
211 " while the syntax rules for SQL are active.
22a6f99e6477 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
212 call sqlcomplete#PreCacheSyntax()
22a6f99e6477 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
213 endif
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
214 endfunction
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
215 command! -nargs=* -complete=custom,SQL_GetList SQLSetType :call SQL_SetType(<q-args>)
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
216
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
217 endif
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
218
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
219 " Functions/Commands to allow the user determine current SQL syntax dialect
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
220 " This works with both Vim 6 and 7.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
221
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
222 if !exists("*SQL_GetType")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
223 function SQL_GetType()
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
224 if exists('b:sql_type_override')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
225 echomsg "Current SQL dialect in use:".b:sql_type_override
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
226 else
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
227 echomsg "Current SQL dialect in use:".g:sql_type_default
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
228 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
229 endfunction
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
230 command! -nargs=0 SQLGetType :call SQL_GetType()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
231 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
232
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
233 if exists("b:sql_type_override")
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
234 " echo 'sourcing buffer ftplugin/'.b:sql_type_override.'.vim'
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
235 if globpath(&runtimepath, 'ftplugin/'.b:sql_type_override.'.vim') != ''
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
236 exec 'runtime ftplugin/'.b:sql_type_override.'.vim'
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
237 " else
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
238 " echomsg 'ftplugin/'.b:sql_type_override.' not exist, using default'
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
239 endif
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
240 elseif exists("g:sql_type_default")
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
241 " echo 'sourcing global ftplugin/'.g:sql_type_default.'.vim'
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
242 if globpath(&runtimepath, 'ftplugin/'.g:sql_type_default.'.vim') != ''
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
243 exec 'runtime ftplugin/'.g:sql_type_default.'.vim'
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
244 " else
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
245 " echomsg 'ftplugin/'.g:sql_type_default.'.vim not exist, using default'
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
246 endif
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
247 endif
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
248
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
249 " If the above runtime command succeeded, do not load the default settings
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
250 if exists("b:did_ftplugin")
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
251 finish
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
252 endif
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
253
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
254 let b:undo_ftplugin = "setl comments< formatoptions< define< omnifunc<" .
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
255 \ " | unlet! b:browsefilter b:match_words"
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
256
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 " Don't load another plugin for this buffer
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
258 let b:did_ftplugin = 1
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
259 let b:current_ftplugin = 'sql'
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
260
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
261 " Win32 can filter files in the browse dialog
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
262 if has("gui_win32") && !exists("b:browsefilter")
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
263 let b:browsefilter = "SQL Files (*.sql)\t*.sql\n" .
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
264 \ "All Files (*.*)\t*.*\n"
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
265 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
267 " Some standard expressions for use with the matchit strings
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
268 let s:notend = '\%(\<end\s\+\)\@<!'
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
269 let s:when_no_matched_or_others = '\%(\<when\>\%(\s\+\%(\%(\<not\>\s\+\)\?<matched\>\)\|\<others\>\)\@!\)'
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
270 let s:or_replace = '\%(or\s\+replace\s\+\)\?'
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
271
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 " Define patterns for the matchit macro
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 if !exists("b:match_words")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 " SQL is generally case insensitive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 let b:match_ignorecase = 1
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
276
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
277 " Handle the following:
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
278 " if
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
279 " elseif | elsif
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
280 " else [if]
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
281 " end if
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
282 "
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
283 " [while condition] loop
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
284 " leave
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
285 " break
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
286 " continue
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
287 " exit
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
288 " end loop
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
289 "
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
290 " for
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
291 " leave
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
292 " break
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
293 " continue
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
294 " exit
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
295 " end loop
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
296 "
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
297 " do
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
298 " statements
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
299 " doend
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
300 "
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
301 " case
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
302 " when
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
303 " when
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
304 " default
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
305 " end case
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
306 "
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
307 " merge
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
308 " when not matched
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
309 " when matched
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
310 "
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
311 " EXCEPTION
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
312 " WHEN column_not_found THEN
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
313 " WHEN OTHERS THEN
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
314 "
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
315 " create[ or replace] procedure|function|event
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2458
diff changeset
316 " \ '^\s*\<\%(do\|for\|while\|loop\)\>.*:'.
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
317
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
318 " For ColdFusion support
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
319 setlocal matchpairs+=<:>
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
320 let b:match_words = &matchpairs .
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
321 \ ',\<begin\>:\<end\>\W*$,'.
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
322 \
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
323 \ s:notend . '\<if\>:'.
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
324 \ '\<elsif\>\|\<elseif\>\|\<else\>:'.
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
325 \ '\<end\s\+if\>,'.
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
326 \
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2458
diff changeset
327 \ '\(^\s*\)\@<=\(\<\%(do\|for\|while\|loop\)\>.*\):'.
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2458
diff changeset
328 \ '\%(\<exit\>\|\<leave\>\|\<break\>\|\<continue\>\):'.
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2458
diff changeset
329 \ '\%(\<doend\>\|\%(\<end\s\+\%(for\|while\|loop\>\)\)\),'.
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
330 \
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
331 \ '\%('. s:notend . '\<case\>\):'.
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
332 \ '\%('.s:when_no_matched_or_others.'\):'.
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
333 \ '\%(\<when\s\+others\>\|\<end\s\+case\>\),' .
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
334 \
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
335 \ '\<merge\>:' .
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
336 \ '\<when\s\+not\s\+matched\>:' .
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
337 \ '\<when\s\+matched\>,' .
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
338 \
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
339 \ '\%(\<create\s\+' . s:or_replace . '\)\?'.
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
340 \ '\%(function\|procedure\|event\):'.
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
341 \ '\<returns\?\>'
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
342 " \ '\<begin\>\|\<returns\?\>:'.
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
343 " \ '\<end\>\(;\)\?\s*$'
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
344 " \ '\<exception\>:'.s:when_no_matched_or_others.
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
345 " \ ':\<when\s\+others\>,'.
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
346 "
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
347 " \ '\%(\<exception\>\|\%('. s:notend . '\<case\>\)\):'.
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
348 " \ '\%(\<default\>\|'.s:when_no_matched_or_others.'\):'.
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
349 " \ '\%(\%(\<when\s\+others\>\)\|\<end\s\+case\>\),' .
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 endif
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
351
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
352 " Define how to find the macro definition of a variable using the various
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
353 " [d, [D, [_CTRL_D and so on features
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
354 " Match these values ignoring case
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
355 " ie DECLARE varname INTEGER
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
356 let &l:define = '\c\<\(VARIABLE\|DECLARE\|IN\|OUT\|INOUT\)\>'
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
357
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
358
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
359 " Mappings to move to the next BEGIN ... END block
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
360 " \W - no characters or digits
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
361 nnoremap <buffer> <silent> ]] :call search('\c^\s*begin\>', 'W' )<CR>
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
362 nnoremap <buffer> <silent> [[ :call search('\c^\s*begin\>', 'bW' )<CR>
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
363 nnoremap <buffer> <silent> ][ :call search('\c^\s*end\W*$', 'W' )<CR>
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
364 nnoremap <buffer> <silent> [] :call search('\c^\s*end\W*$', 'bW' )<CR>
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
365 xnoremap <buffer> <silent> ]] :<C-U>exec "normal! gv"<Bar>call search('\c^\s*begin\>', 'W' )<CR>
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
366 xnoremap <buffer> <silent> [[ :<C-U>exec "normal! gv"<Bar>call search('\c^\s*begin\>', 'bW' )<CR>
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
367 xnoremap <buffer> <silent> ][ :<C-U>exec "normal! gv"<Bar>call search('\c^\s*end\W*$', 'W' )<CR>
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
368 xnoremap <buffer> <silent> [] :<C-U>exec "normal! gv"<Bar>call search('\c^\s*end\W*$', 'bW' )<CR>
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
369
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
370
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
371 " By default only look for CREATE statements, but allow
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
372 " the user to override
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
373 if !exists('g:ftplugin_sql_statements')
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
374 let g:ftplugin_sql_statements = 'create'
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
375 endif
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
376
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
377 " Predefined SQL objects what are used by the below mappings using
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
378 " the ]} style maps.
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
379 " This global variable allows the users to override it's value
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
380 " from within their vimrc.
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
381 " Note, you cannot use \?, since these patterns can be used to search
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
382 " backwards, you must use \{,1}
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
383 if !exists('g:ftplugin_sql_objects')
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
384 let g:ftplugin_sql_objects = 'function,procedure,event,' .
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
385 \ '\(existing\\|global\s\+temporary\s\+\)\{,1}' .
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
386 \ 'table,trigger' .
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
387 \ ',schema,service,publication,database,datatype,domain' .
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
388 \ ',index,subscription,synchronization,view,variable'
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
389 endif
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
390
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
391 " Key to trigger SQL completion
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
392 if !exists('g:ftplugin_sql_omni_key')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
393 let g:ftplugin_sql_omni_key = '<C-C>'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
394 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
395 " Key to trigger drill into column list
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
396 if !exists('g:ftplugin_sql_omni_key_right')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
397 let g:ftplugin_sql_omni_key_right = '<Right>'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
398 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
399 " Key to trigger drill out of column list
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
400 if !exists('g:ftplugin_sql_omni_key_left')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
401 let g:ftplugin_sql_omni_key_left = '<Left>'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
402 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
403
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
404 " Replace all ,'s with bars, except ones with numbers after them.
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
405 " This will most likely be a \{,1} string.
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
406 let s:ftplugin_sql_objects =
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
407 \ '\c^\s*' .
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
408 \ '\(\(' .
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
409 \ substitute(g:ftplugin_sql_statements, ',\d\@!', '\\\\|', 'g') .
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
410 \ '\)\s\+\(or\s\+replace\s\+\)\{,1}\)\{,1}' .
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
411 \ '\<\(' .
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
412 \ substitute(g:ftplugin_sql_objects, ',\d\@!', '\\\\|', 'g') .
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
413 \ '\)\>'
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
414
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
415 " Mappings to move to the next CREATE ... block
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
416 exec "nnoremap <buffer> <silent> ]} :call search('".s:ftplugin_sql_objects."', 'W')<CR>"
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
417 exec "nnoremap <buffer> <silent> [{ :call search('".s:ftplugin_sql_objects."', 'bW')<CR>"
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
418 " Could not figure out how to use a :call search() string in visual mode
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
419 " without it ending visual mode
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
420 " Unfortunately, this will add a entry to the search history
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
421 exec 'xnoremap <buffer> <silent> ]} /'.s:ftplugin_sql_objects.'<CR>'
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
422 exec 'xnoremap <buffer> <silent> [{ ?'.s:ftplugin_sql_objects.'<CR>'
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
423
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
424 " Mappings to move to the next COMMENT
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
425 "
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
426 " Had to double the \ for the \| separator since this has a special
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
427 " meaning on maps
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
428 let b:comment_leader = '\(--\\|\/\/\\|\*\\|\/\*\\|\*\/\)'
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
429 " Find the start of the next comment
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
430 let b:comment_start = '^\(\s*'.b:comment_leader.'.*\n\)\@<!'.
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
431 \ '\(\s*'.b:comment_leader.'\)'
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
432 " Find the end of the previous comment
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
433 let b:comment_end = '\(^\s*'.b:comment_leader.'.*\n\)'.
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
434 \ '\(^\s*'.b:comment_leader.'\)\@!'
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
435 " Skip over the comment
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
436 let b:comment_jump_over = "call search('".
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
437 \ '^\(\s*'.b:comment_leader.'.*\n\)\@<!'.
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
438 \ "', 'W')"
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
439 let b:comment_skip_back = "call search('".
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
440 \ '^\(\s*'.b:comment_leader.'.*\n\)\@<!'.
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
441 \ "', 'bW')"
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
442 " Move to the start and end of comments
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 844
diff changeset
443 exec 'nnoremap <silent><buffer> ]" :call search('."'".b:comment_start."'".', "W" )<CR>'
73fe8baea242 updated for version 7.2a
vimboss
parents: 844
diff changeset
444 exec 'nnoremap <silent><buffer> [" :call search('."'".b:comment_end."'".', "W" )<CR>'
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
445 exec 'xnoremap <silent><buffer> ]" :<C-U>exec "normal! gv"<Bar>call search('."'".b:comment_start."'".', "W" )<CR>'
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
446 exec 'xnoremap <silent><buffer> [" :<C-U>exec "normal! gv"<Bar>call search('."'".b:comment_end."'".', "W" )<CR>'
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
447
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
448 " Comments can be of the form:
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
449 " /*
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
450 " *
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
451 " */
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
452 " or
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
453 " --
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
454 " or
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
455 " //
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
456 setlocal comments=s1:/*,mb:*,ex:*/,:--,://
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
457
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
458 " Set completion with CTRL-X CTRL-O to autoloaded function.
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
459 if exists('&omnifunc')
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 818
diff changeset
460 " Since the SQL completion plugin can be used in conjunction
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 818
diff changeset
461 " with other completion filetypes it must record the previous
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 818
diff changeset
462 " OMNI function prior to setting up the SQL OMNI function
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 818
diff changeset
463 let b:sql_compl_savefunc = &omnifunc
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 818
diff changeset
464
4437
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3996
diff changeset
465 " Source it to determine it's version
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3996
diff changeset
466 runtime autoload/sqlcomplete.vim
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
467 " This is used by the sqlcomplete.vim plugin
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
468 " Source it for it's global functions
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
469 runtime autoload/syntaxcomplete.vim
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
470
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
471 setlocal omnifunc=sqlcomplete#Complete
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
472 " Prevent the intellisense plugin from loading
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
473 let b:sql_vis = 1
818
1f929f3ca806 updated for version 7.0c03
vimboss
parents: 718
diff changeset
474 if !exists('g:omni_sql_no_default_maps')
4437
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3996
diff changeset
475 let regex_extra = ''
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3996
diff changeset
476 if exists('g:loaded_syntax_completion') && exists('g:loaded_sql_completion')
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3996
diff changeset
477 if g:loaded_syntax_completion > 120 && g:loaded_sql_completion > 140
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3996
diff changeset
478 let regex_extra = '\\w*'
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3996
diff changeset
479 endif
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3996
diff changeset
480 endif
818
1f929f3ca806 updated for version 7.0c03
vimboss
parents: 718
diff changeset
481 " Static maps which use populate the completion list
1f929f3ca806 updated for version 7.0c03
vimboss
parents: 718
diff changeset
482 " using Vim's syntax highlighting rules
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
483 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'a <C-\><C-O>:call sqlcomplete#Map("syntax")<CR><C-X><C-O>'
4437
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3996
diff changeset
484 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'k <C-\><C-O>:call sqlcomplete#Map("sqlKeyword'.regex_extra.'")<CR><C-X><C-O>'
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3996
diff changeset
485 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'f <C-\><C-O>:call sqlcomplete#Map("sqlFunction'.regex_extra.'")<CR><C-X><C-O>'
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3996
diff changeset
486 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'o <C-\><C-O>:call sqlcomplete#Map("sqlOption'.regex_extra.'")<CR><C-X><C-O>'
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3996
diff changeset
487 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'T <C-\><C-O>:call sqlcomplete#Map("sqlType'.regex_extra.'")<CR><C-X><C-O>'
eb6ab7e78925 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3996
diff changeset
488 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'s <C-\><C-O>:call sqlcomplete#Map("sqlStatement'.regex_extra.'")<CR><C-X><C-O>'
818
1f929f3ca806 updated for version 7.0c03
vimboss
parents: 718
diff changeset
489 " Dynamic maps which use populate the completion list
1f929f3ca806 updated for version 7.0c03
vimboss
parents: 718
diff changeset
490 " using the dbext.vim plugin
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
491 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'t <C-\><C-O>:call sqlcomplete#Map("table")<CR><C-X><C-O>'
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
492 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'p <C-\><C-O>:call sqlcomplete#Map("procedure")<CR><C-X><C-O>'
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
493 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'v <C-\><C-O>:call sqlcomplete#Map("view")<CR><C-X><C-O>'
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
494 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'c <C-\><C-O>:call sqlcomplete#Map("column")<CR><C-X><C-O>'
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
495 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'l <C-\><C-O>:call sqlcomplete#Map("column_csv")<CR><C-X><C-O>'
818
1f929f3ca806 updated for version 7.0c03
vimboss
parents: 718
diff changeset
496 " The next 3 maps are only to be used while the completion window is
1f929f3ca806 updated for version 7.0c03
vimboss
parents: 718
diff changeset
497 " active due to the <CR> at the beginning of the map
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
498 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'L <C-Y><C-\><C-O>:call sqlcomplete#Map("column_csv")<CR><C-X><C-O>'
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 818
diff changeset
499 " <C-Right> is not recognized on most Unix systems, so only create
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 818
diff changeset
500 " these additional maps on the Windows platform.
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 818
diff changeset
501 " If you would like to use these maps, choose a different key and make
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 818
diff changeset
502 " the same map in your vimrc.
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
503 " if has('win32')
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
504 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key_right.' <C-R>=sqlcomplete#DrillIntoTable()<CR>'
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
505 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key_left.' <C-R>=sqlcomplete#DrillOutOfColumns()<CR>'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
506 " endif
818
1f929f3ca806 updated for version 7.0c03
vimboss
parents: 718
diff changeset
507 " Remove any cached items useful for schema changes
3996
b3f3237a3d72 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
508 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'R <C-\><C-O>:call sqlcomplete#Map("resetCache")<CR><C-X><C-O>'
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 818
diff changeset
509 endif
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 818
diff changeset
510
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 818
diff changeset
511 if b:sql_compl_savefunc != ""
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 818
diff changeset
512 " We are changing the filetype to SQL from some other filetype
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 818
diff changeset
513 " which had OMNI completion defined. We need to activate the
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 818
diff changeset
514 " SQL completion plugin in order to cache some of the syntax items
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 818
diff changeset
515 " while the syntax rules for SQL are active.
2458
22a6f99e6477 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
516 call sqlcomplete#ResetCacheSyntax()
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 818
diff changeset
517 call sqlcomplete#PreCacheSyntax()
818
1f929f3ca806 updated for version 7.0c03
vimboss
parents: 718
diff changeset
518 endif
718
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
519 endif
7b21554be7a1 updated for version 7.0219
vimboss
parents: 167
diff changeset
520
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
521 let &cpo = s:save_cpo
3410
94601b379f38 Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents: 2751
diff changeset
522 unlet s:save_cpo
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 7
diff changeset
523
818
1f929f3ca806 updated for version 7.0c03
vimboss
parents: 718
diff changeset
524 " vim:sw=4: