Mercurial > vim
comparison runtime/ftplugin/sql.vim @ 3996:b3f3237a3d72
Update runtime files.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 05 Dec 2012 19:01:43 +0100 |
parents | dd6c2497c997 |
children | eb6ab7e78925 |
comparison
equal
deleted
inserted
replaced
3995:c2ea289a5b7f | 3996:b3f3237a3d72 |
---|---|
1 " SQL filetype plugin file | 1 " SQL filetype plugin file |
2 " Language: SQL (Common for Oracle, Microsoft SQL Server, Sybase) | 2 " Language: SQL (Common for Oracle, Microsoft SQL Server, Sybase) |
3 " Version: 8.0 | 3 " Version: 10.0 |
4 " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> | 4 " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> |
5 " Last Change: 2012 May 18 | 5 " Last Change: 2012 Dec 04 |
6 " Download: http://vim.sourceforge.net/script.php?script_id=454 | 6 " Download: http://vim.sourceforge.net/script.php?script_id=454 |
7 | 7 |
8 " For more details please use: | 8 " For more details please use: |
9 " :h sql.txt | 9 " :h sql.txt |
10 " | 10 " |
28 " :SQLSetType <tab> | 28 " :SQLSetType <tab> |
29 " | 29 " |
30 " To change the default dialect, add the following to your vimrc: | 30 " To change the default dialect, add the following to your vimrc: |
31 " let g:sql_type_default = 'sqlanywhere' | 31 " let g:sql_type_default = 'sqlanywhere' |
32 " | 32 " |
33 " This file also creates a command, SQLGetType, which allows you to | 33 " This file also creates a command, SQLGetType, which allows you to |
34 " determine what the current dialect is in use. | 34 " determine what the current dialect is in use. |
35 " :SQLGetType | 35 " :SQLGetType |
36 " | 36 " |
37 " History | 37 " History |
38 " | 38 " |
39 " Version 10.0 (Dec 2012) | |
40 " | |
41 " NF: Changed all maps to use noremap instead of must map | |
42 " NF: Changed all visual maps to use xnoremap instead of vnoremap as they | |
43 " should only be used in visual mode and not select mode. | |
44 " BF: Most of the maps were using doubled up backslashes before they were | |
45 " changed to using the search() function, which meant they no longer | |
46 " worked. | |
47 " | |
48 " Version 9.0 | |
49 " | |
50 " NF: Completes 'b:undo_ftplugin' | |
51 " BF: Correctly set cpoptions when creating script | |
52 " | |
39 " Version 8.0 | 53 " Version 8.0 |
40 " | 54 " |
41 " NF: Improved the matchit plugin regex (Talek) | 55 " NF: Improved the matchit plugin regex (Talek) |
42 " | 56 " |
43 " Version 7.0 | 57 " Version 7.0 |
44 " | 58 " |
45 " NF: Calls the sqlcomplete#ResetCacheSyntax() function when calling | 59 " NF: Calls the sqlcomplete#ResetCacheSyntax() function when calling |
46 " SQLSetType. | 60 " SQLSetType. |
47 " | 61 " |
48 " Version 6.0 | 62 " Version 6.0 |
49 " | 63 " |
50 " NF: Adds the command SQLGetType | 64 " NF: Adds the command SQLGetType |
51 " | 65 " |
52 " Version 5.0 | 66 " Version 5.0 |
53 " | 67 " |
54 " NF: Adds the ability to choose the keys to control SQL completion, just add | 68 " NF: Adds the ability to choose the keys to control SQL completion, just add |
55 " the following to your .vimrc: | 69 " the following to your .vimrc: |
56 " let g:ftplugin_sql_omni_key = '<C-C>' | 70 " let g:ftplugin_sql_omni_key = '<C-C>' |
57 " let g:ftplugin_sql_omni_key_right = '<Right>' | 71 " let g:ftplugin_sql_omni_key_right = '<Right>' |
58 " let g:ftplugin_sql_omni_key_left = '<Left>' | 72 " let g:ftplugin_sql_omni_key_left = '<Left>' |
59 " | 73 " |
60 " BF: format-options - Auto-wrap comments using textwidth was turned off | 74 " BF: format-options - Auto-wrap comments using textwidth was turned off |
61 " by mistake. | 75 " by mistake. |
62 | 76 |
63 | 77 |
64 " Only do this when not done yet for this buffer | 78 " Only do this when not done yet for this buffer |
65 if exists("b:did_ftplugin") | 79 if exists("b:did_ftplugin") |
79 " Functions/Commands to allow the user to change SQL syntax dialects | 93 " Functions/Commands to allow the user to change SQL syntax dialects |
80 " through the use of :SQLSetType <tab> for completion. | 94 " through the use of :SQLSetType <tab> for completion. |
81 " This works with both Vim 6 and 7. | 95 " This works with both Vim 6 and 7. |
82 | 96 |
83 if !exists("*SQL_SetType") | 97 if !exists("*SQL_SetType") |
84 " NOTE: You cannot use function! since this file can be | 98 " NOTE: You cannot use function! since this file can be |
85 " sourced from within this function. That will result in | 99 " sourced from within this function. That will result in |
86 " an error reported by Vim. | 100 " an error reported by Vim. |
87 function SQL_GetList(ArgLead, CmdLine, CursorPos) | 101 function SQL_GetList(ArgLead, CmdLine, CursorPos) |
88 | 102 |
89 if !exists('s:sql_list') | 103 if !exists('s:sql_list') |
103 " | 117 " |
104 " Replace it with just the filename (get rid of PATH) | 118 " Replace it with just the filename (get rid of PATH) |
105 " | 119 " |
106 " Recursively, since there are many filenames that contain | 120 " Recursively, since there are many filenames that contain |
107 " the word SQL in the indent, syntax and ftplugin directory | 121 " the word SQL in the indent, syntax and ftplugin directory |
108 let sqls = substitute( sqls, | 122 let sqls = substitute( sqls, |
109 \ '[\n]\%(.\{-}\)\(\w\+\.\w\+\)\n\@=', | 123 \ '[\n]\%(.\{-}\)\(\w\+\.\w\+\)\n\@=', |
110 \ '\1\n', | 124 \ '\1\n', |
111 \ 'g' | 125 \ 'g' |
112 \ ) | 126 \ ) |
113 | 127 |
114 " Remove duplicates, since sqlanywhere.vim can exist in the | 128 " Remove duplicates, since sqlanywhere.vim can exist in the |
115 " sytax, indent and ftplugin directory, yet we only want | 129 " sytax, indent and ftplugin directory, yet we only want |
140 endfunction | 154 endfunction |
141 | 155 |
142 function SQL_SetType(name) | 156 function SQL_SetType(name) |
143 | 157 |
144 " User has decided to override default SQL scripts and | 158 " User has decided to override default SQL scripts and |
145 " specify a vendor specific version | 159 " specify a vendor specific version |
146 " (ie Oracle, Informix, SQL Anywhere, ...) | 160 " (ie Oracle, Informix, SQL Anywhere, ...) |
147 " So check for an remove any settings that prevent the | 161 " So check for an remove any settings that prevent the |
148 " scripts from being executed, and then source the | 162 " scripts from being executed, and then source the |
149 " appropriate Vim scripts. | 163 " appropriate Vim scripts. |
150 if exists("b:did_ftplugin") | 164 if exists("b:did_ftplugin") |
151 unlet b:did_ftplugin | 165 unlet b:did_ftplugin |
152 endif | 166 endif |
153 if exists("b:current_syntax") | 167 if exists("b:current_syntax") |
161 setlocal indentkeys& | 175 setlocal indentkeys& |
162 setlocal indentexpr& | 176 setlocal indentexpr& |
163 endif | 177 endif |
164 | 178 |
165 " Ensure the name is in the correct format | 179 " Ensure the name is in the correct format |
166 let new_sql_type = substitute(a:name, | 180 let new_sql_type = substitute(a:name, |
167 \ '\s*\([^\.]\+\)\(\.\w\+\)\?', '\L\1', '') | 181 \ '\s*\([^\.]\+\)\(\.\w\+\)\?', '\L\1', '') |
168 | 182 |
169 " Do not specify a buffer local variable if it is | 183 " Do not specify a buffer local variable if it is |
170 " the default value | 184 " the default value |
171 if new_sql_type == 'sql' | 185 if new_sql_type == 'sql' |
172 let new_sql_type = 'sqloracle' | 186 let new_sql_type = 'sqloracle' |
173 endif | 187 endif |
174 let b:sql_type_override = new_sql_type | 188 let b:sql_type_override = new_sql_type |
201 " Functions/Commands to allow the user determine current SQL syntax dialect | 215 " Functions/Commands to allow the user determine current SQL syntax dialect |
202 " This works with both Vim 6 and 7. | 216 " This works with both Vim 6 and 7. |
203 | 217 |
204 if !exists("*SQL_GetType") | 218 if !exists("*SQL_GetType") |
205 function SQL_GetType() | 219 function SQL_GetType() |
206 if exists('b:sql_type_override') | 220 if exists('b:sql_type_override') |
207 echomsg "Current SQL dialect in use:".b:sql_type_override | 221 echomsg "Current SQL dialect in use:".b:sql_type_override |
208 else | 222 else |
209 echomsg "Current SQL dialect in use:".g:sql_type_default | 223 echomsg "Current SQL dialect in use:".g:sql_type_default |
210 endif | 224 endif |
211 endfunction | 225 endfunction |
212 command! -nargs=0 SQLGetType :call SQL_GetType() | 226 command! -nargs=0 SQLGetType :call SQL_GetType() |
213 endif | 227 endif |
214 | 228 |
231 " If the above runtime command succeeded, do not load the default settings | 245 " If the above runtime command succeeded, do not load the default settings |
232 if exists("b:did_ftplugin") | 246 if exists("b:did_ftplugin") |
233 finish | 247 finish |
234 endif | 248 endif |
235 | 249 |
236 let b:undo_ftplugin = "setl comments<" | 250 let b:undo_ftplugin = "setl comments< formatoptions< define< omnifunc<" . |
251 \ " | unlet! b:browsefilter b:match_words" | |
237 | 252 |
238 " Don't load another plugin for this buffer | 253 " Don't load another plugin for this buffer |
239 let b:did_ftplugin = 1 | 254 let b:did_ftplugin = 1 |
240 let b:current_ftplugin = 'sql' | 255 let b:current_ftplugin = 'sql' |
241 | 256 |
278 " do | 293 " do |
279 " statements | 294 " statements |
280 " doend | 295 " doend |
281 " | 296 " |
282 " case | 297 " case |
283 " when | 298 " when |
284 " when | 299 " when |
285 " default | 300 " default |
286 " end case | 301 " end case |
287 " | 302 " |
288 " merge | 303 " merge |
294 " WHEN OTHERS THEN | 309 " WHEN OTHERS THEN |
295 " | 310 " |
296 " create[ or replace] procedure|function|event | 311 " create[ or replace] procedure|function|event |
297 " \ '^\s*\<\%(do\|for\|while\|loop\)\>.*:'. | 312 " \ '^\s*\<\%(do\|for\|while\|loop\)\>.*:'. |
298 | 313 |
299 let b:match_words = | 314 " For ColdFusion support |
300 \ '\<begin\>:\<end\>\W*$,'. | 315 setlocal matchpairs+=<:> |
316 let b:match_words = &matchpairs . | |
317 \ ',\<begin\>:\<end\>\W*$,'. | |
301 \ | 318 \ |
302 \ s:notend . '\<if\>:'. | 319 \ s:notend . '\<if\>:'. |
303 \ '\<elsif\>\|\<elseif\>\|\<else\>:'. | 320 \ '\<elsif\>\|\<elseif\>\|\<else\>:'. |
304 \ '\<end\s\+if\>,'. | 321 \ '\<end\s\+if\>,'. |
305 \ | 322 \ |
335 let &l:define = '\c\<\(VARIABLE\|DECLARE\|IN\|OUT\|INOUT\)\>' | 352 let &l:define = '\c\<\(VARIABLE\|DECLARE\|IN\|OUT\|INOUT\)\>' |
336 | 353 |
337 | 354 |
338 " Mappings to move to the next BEGIN ... END block | 355 " Mappings to move to the next BEGIN ... END block |
339 " \W - no characters or digits | 356 " \W - no characters or digits |
340 nmap <buffer> <silent> ]] :call search('\\c^\\s*begin\\>', 'W' )<CR> | 357 nnoremap <buffer> <silent> ]] :call search('\c^\s*begin\>', 'W' )<CR> |
341 nmap <buffer> <silent> [[ :call search('\\c^\\s*begin\\>', 'bW' )<CR> | 358 nnoremap <buffer> <silent> [[ :call search('\c^\s*begin\>', 'bW' )<CR> |
342 nmap <buffer> <silent> ][ :call search('\\c^\\s*end\\W*$', 'W' )<CR> | 359 nnoremap <buffer> <silent> ][ :call search('\c^\s*end\W*$', 'W' )<CR> |
343 nmap <buffer> <silent> [] :call search('\\c^\\s*end\\W*$', 'bW' )<CR> | 360 nnoremap <buffer> <silent> [] :call search('\c^\s*end\W*$', 'bW' )<CR> |
344 vmap <buffer> <silent> ]] :<C-U>exec "normal! gv"<Bar>call search('\\c^\\s*begin\\>', 'W' )<CR> | 361 xnoremap <buffer> <silent> ]] :<C-U>exec "normal! gv"<Bar>call search('\c^\s*begin\>', 'W' )<CR> |
345 vmap <buffer> <silent> [[ :<C-U>exec "normal! gv"<Bar>call search('\\c^\\s*begin\\>', 'bW' )<CR> | 362 xnoremap <buffer> <silent> [[ :<C-U>exec "normal! gv"<Bar>call search('\c^\s*begin\>', 'bW' )<CR> |
346 vmap <buffer> <silent> ][ :<C-U>exec "normal! gv"<Bar>call search('\\c^\\s*end\\W*$', 'W' )<CR> | 363 xnoremap <buffer> <silent> ][ :<C-U>exec "normal! gv"<Bar>call search('\c^\s*end\W*$', 'W' )<CR> |
347 vmap <buffer> <silent> [] :<C-U>exec "normal! gv"<Bar>call search('\\c^\\s*end\\W*$', 'bW' )<CR> | 364 xnoremap <buffer> <silent> [] :<C-U>exec "normal! gv"<Bar>call search('\c^\s*end\W*$', 'bW' )<CR> |
348 | 365 |
349 | 366 |
350 " By default only look for CREATE statements, but allow | 367 " By default only look for CREATE statements, but allow |
351 " the user to override | 368 " the user to override |
352 if !exists('g:ftplugin_sql_statements') | 369 if !exists('g:ftplugin_sql_statements') |
359 " from within their vimrc. | 376 " from within their vimrc. |
360 " Note, you cannot use \?, since these patterns can be used to search | 377 " Note, you cannot use \?, since these patterns can be used to search |
361 " backwards, you must use \{,1} | 378 " backwards, you must use \{,1} |
362 if !exists('g:ftplugin_sql_objects') | 379 if !exists('g:ftplugin_sql_objects') |
363 let g:ftplugin_sql_objects = 'function,procedure,event,' . | 380 let g:ftplugin_sql_objects = 'function,procedure,event,' . |
364 \ '\\(existing\\\\|global\\s\\+temporary\\s\\+\\)\\\{,1}' . | 381 \ '\(existing\\|global\s\+temporary\s\+\)\{,1}' . |
365 \ 'table,trigger' . | 382 \ 'table,trigger' . |
366 \ ',schema,service,publication,database,datatype,domain' . | 383 \ ',schema,service,publication,database,datatype,domain' . |
367 \ ',index,subscription,synchronization,view,variable' | 384 \ ',index,subscription,synchronization,view,variable' |
368 endif | 385 endif |
369 | 386 |
380 let g:ftplugin_sql_omni_key_left = '<Left>' | 397 let g:ftplugin_sql_omni_key_left = '<Left>' |
381 endif | 398 endif |
382 | 399 |
383 " Replace all ,'s with bars, except ones with numbers after them. | 400 " Replace all ,'s with bars, except ones with numbers after them. |
384 " This will most likely be a \{,1} string. | 401 " This will most likely be a \{,1} string. |
385 let s:ftplugin_sql_objects = | 402 let s:ftplugin_sql_objects = |
386 \ '\\c^\\s*' . | 403 \ '\c^\s*' . |
387 \ '\\(\\(' . | 404 \ '\(\(' . |
388 \ substitute(g:ftplugin_sql_statements, ',\d\@!', '\\\\\\|', 'g') . | 405 \ substitute(g:ftplugin_sql_statements, ',\d\@!', '\\\\|', 'g') . |
389 \ '\\)\\s\\+\\(or\\s\\+replace\\\s\+\\)\\{,1}\\)\\{,1}' . | 406 \ '\)\s\+\(or\s\+replace\s\+\)\{,1}\)\{,1}' . |
390 \ '\\<\\(' . | 407 \ '\<\(' . |
391 \ substitute(g:ftplugin_sql_objects, ',\d\@!', '\\\\\\|', 'g') . | 408 \ substitute(g:ftplugin_sql_objects, ',\d\@!', '\\\\|', 'g') . |
392 \ '\\)\\>' | 409 \ '\)\>' |
393 | 410 |
394 " Mappings to move to the next CREATE ... block | 411 " Mappings to move to the next CREATE ... block |
395 exec "nmap <buffer> <silent> ]} :call search('".s:ftplugin_sql_objects."', 'W')<CR>" | 412 exec "nnoremap <buffer> <silent> ]} :call search('".s:ftplugin_sql_objects."', 'W')<CR>" |
396 exec "nmap <buffer> <silent> [{ :call search('".s:ftplugin_sql_objects."', 'bW')<CR>" | 413 exec "nnoremap <buffer> <silent> [{ :call search('".s:ftplugin_sql_objects."', 'bW')<CR>" |
397 " Could not figure out how to use a :call search() string in visual mode | 414 " Could not figure out how to use a :call search() string in visual mode |
398 " without it ending visual mode | 415 " without it ending visual mode |
399 " Unfortunately, this will add a entry to the search history | 416 " Unfortunately, this will add a entry to the search history |
400 exec 'vmap <buffer> <silent> ]} /'.s:ftplugin_sql_objects.'<CR>' | 417 exec 'xnoremap <buffer> <silent> ]} /'.s:ftplugin_sql_objects.'<CR>' |
401 exec 'vmap <buffer> <silent> [{ ?'.s:ftplugin_sql_objects.'<CR>' | 418 exec 'xnoremap <buffer> <silent> [{ ?'.s:ftplugin_sql_objects.'<CR>' |
402 | 419 |
403 " Mappings to move to the next COMMENT | 420 " Mappings to move to the next COMMENT |
404 " | 421 " |
405 " Had to double the \ for the \| separator since this has a special | 422 " Had to double the \ for the \| separator since this has a special |
406 " meaning on maps | 423 " meaning on maps |
407 let b:comment_leader = '\\(--\\\|\\/\\/\\\|\\*\\\|\\/\\*\\\|\\*\\/\\)' | 424 let b:comment_leader = '\(--\\|\/\/\\|\*\\|\/\*\\|\*\/\)' |
408 " Find the start of the next comment | 425 " Find the start of the next comment |
409 let b:comment_start = '^\\(\\s*'.b:comment_leader.'.*\\n\\)\\@<!'. | 426 let b:comment_start = '^\(\s*'.b:comment_leader.'.*\n\)\@<!'. |
410 \ '\\(\\s*'.b:comment_leader.'\\)' | 427 \ '\(\s*'.b:comment_leader.'\)' |
411 " Find the end of the previous comment | 428 " Find the end of the previous comment |
412 let b:comment_end = '\\(^\\s*'.b:comment_leader.'.*\\n\\)'. | 429 let b:comment_end = '\(^\s*'.b:comment_leader.'.*\n\)'. |
413 \ '\\(^\\s*'.b:comment_leader.'\\)\\@!' | 430 \ '\(^\s*'.b:comment_leader.'\)\@!' |
414 " Skip over the comment | 431 " Skip over the comment |
415 let b:comment_jump_over = "call search('". | 432 let b:comment_jump_over = "call search('". |
416 \ '^\\(\\s*'.b:comment_leader.'.*\\n\\)\\@<!'. | 433 \ '^\(\s*'.b:comment_leader.'.*\n\)\@<!'. |
417 \ "', 'W')" | 434 \ "', 'W')" |
418 let b:comment_skip_back = "call search('". | 435 let b:comment_skip_back = "call search('". |
419 \ '^\\(\\s*'.b:comment_leader.'.*\\n\\)\\@<!'. | 436 \ '^\(\s*'.b:comment_leader.'.*\n\)\@<!'. |
420 \ "', 'bW')" | 437 \ "', 'bW')" |
421 " Move to the start and end of comments | 438 " Move to the start and end of comments |
422 exec 'nnoremap <silent><buffer> ]" :call search('."'".b:comment_start."'".', "W" )<CR>' | 439 exec 'nnoremap <silent><buffer> ]" :call search('."'".b:comment_start."'".', "W" )<CR>' |
423 exec 'nnoremap <silent><buffer> [" :call search('."'".b:comment_end."'".', "W" )<CR>' | 440 exec 'nnoremap <silent><buffer> [" :call search('."'".b:comment_end."'".', "W" )<CR>' |
424 exec 'vnoremap <silent><buffer> ]" :<C-U>exec "normal! gv"<Bar>call search('."'".b:comment_start."'".', "W" )<CR>' | 441 exec 'xnoremap <silent><buffer> ]" :<C-U>exec "normal! gv"<Bar>call search('."'".b:comment_start."'".', "W" )<CR>' |
425 exec 'vnoremap <silent><buffer> [" :<C-U>exec "normal! gv"<Bar>call search('."'".b:comment_end."'".', "W" )<CR>' | 442 exec 'xnoremap <silent><buffer> [" :<C-U>exec "normal! gv"<Bar>call search('."'".b:comment_end."'".', "W" )<CR>' |
426 | 443 |
427 " Comments can be of the form: | 444 " Comments can be of the form: |
428 " /* | 445 " /* |
429 " * | 446 " * |
430 " */ | 447 " */ |
431 " or | 448 " or |
432 " -- | 449 " -- |
433 " or | 450 " or |
434 " // | 451 " // |
435 setlocal comments=s1:/*,mb:*,ex:*/,:--,:// | 452 setlocal comments=s1:/*,mb:*,ex:*/,:--,:// |
436 | 453 |
437 " Set completion with CTRL-X CTRL-O to autoloaded function. | 454 " Set completion with CTRL-X CTRL-O to autoloaded function. |
438 if exists('&omnifunc') | 455 if exists('&omnifunc') |
439 " Since the SQL completion plugin can be used in conjunction | 456 " Since the SQL completion plugin can be used in conjunction |
441 " OMNI function prior to setting up the SQL OMNI function | 458 " OMNI function prior to setting up the SQL OMNI function |
442 let b:sql_compl_savefunc = &omnifunc | 459 let b:sql_compl_savefunc = &omnifunc |
443 | 460 |
444 " This is used by the sqlcomplete.vim plugin | 461 " This is used by the sqlcomplete.vim plugin |
445 " Source it for it's global functions | 462 " Source it for it's global functions |
446 runtime autoload/syntaxcomplete.vim | 463 runtime autoload/syntaxcomplete.vim |
447 | 464 |
448 setlocal omnifunc=sqlcomplete#Complete | 465 setlocal omnifunc=sqlcomplete#Complete |
449 " Prevent the intellisense plugin from loading | 466 " Prevent the intellisense plugin from loading |
450 let b:sql_vis = 1 | 467 let b:sql_vis = 1 |
451 if !exists('g:omni_sql_no_default_maps') | 468 if !exists('g:omni_sql_no_default_maps') |
452 " Static maps which use populate the completion list | 469 " Static maps which use populate the completion list |
453 " using Vim's syntax highlighting rules | 470 " using Vim's syntax highlighting rules |
454 exec 'imap <buffer> '.g:ftplugin_sql_omni_key.'a <C-\><C-O>:call sqlcomplete#Map("syntax")<CR><C-X><C-O>' | 471 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'a <C-\><C-O>:call sqlcomplete#Map("syntax")<CR><C-X><C-O>' |
455 exec 'imap <buffer> '.g:ftplugin_sql_omni_key.'k <C-\><C-O>:call sqlcomplete#Map("sqlKeyword")<CR><C-X><C-O>' | 472 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'k <C-\><C-O>:call sqlcomplete#Map("sqlKeyword")<CR><C-X><C-O>' |
456 exec 'imap <buffer> '.g:ftplugin_sql_omni_key.'f <C-\><C-O>:call sqlcomplete#Map("sqlFunction")<CR><C-X><C-O>' | 473 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'f <C-\><C-O>:call sqlcomplete#Map("sqlFunction")<CR><C-X><C-O>' |
457 exec 'imap <buffer> '.g:ftplugin_sql_omni_key.'o <C-\><C-O>:call sqlcomplete#Map("sqlOption")<CR><C-X><C-O>' | 474 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'o <C-\><C-O>:call sqlcomplete#Map("sqlOption")<CR><C-X><C-O>' |
458 exec 'imap <buffer> '.g:ftplugin_sql_omni_key.'T <C-\><C-O>:call sqlcomplete#Map("sqlType")<CR><C-X><C-O>' | 475 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'T <C-\><C-O>:call sqlcomplete#Map("sqlType")<CR><C-X><C-O>' |
459 exec 'imap <buffer> '.g:ftplugin_sql_omni_key.'s <C-\><C-O>:call sqlcomplete#Map("sqlStatement")<CR><C-X><C-O>' | 476 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'s <C-\><C-O>:call sqlcomplete#Map("sqlStatement")<CR><C-X><C-O>' |
460 " Dynamic maps which use populate the completion list | 477 " Dynamic maps which use populate the completion list |
461 " using the dbext.vim plugin | 478 " using the dbext.vim plugin |
462 exec 'imap <buffer> '.g:ftplugin_sql_omni_key.'t <C-\><C-O>:call sqlcomplete#Map("table")<CR><C-X><C-O>' | 479 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'t <C-\><C-O>:call sqlcomplete#Map("table")<CR><C-X><C-O>' |
463 exec 'imap <buffer> '.g:ftplugin_sql_omni_key.'p <C-\><C-O>:call sqlcomplete#Map("procedure")<CR><C-X><C-O>' | 480 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'p <C-\><C-O>:call sqlcomplete#Map("procedure")<CR><C-X><C-O>' |
464 exec 'imap <buffer> '.g:ftplugin_sql_omni_key.'v <C-\><C-O>:call sqlcomplete#Map("view")<CR><C-X><C-O>' | 481 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'v <C-\><C-O>:call sqlcomplete#Map("view")<CR><C-X><C-O>' |
465 exec 'imap <buffer> '.g:ftplugin_sql_omni_key.'c <C-\><C-O>:call sqlcomplete#Map("column")<CR><C-X><C-O>' | 482 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'c <C-\><C-O>:call sqlcomplete#Map("column")<CR><C-X><C-O>' |
466 exec 'imap <buffer> '.g:ftplugin_sql_omni_key.'l <C-\><C-O>:call sqlcomplete#Map("column_csv")<CR><C-X><C-O>' | 483 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'l <C-\><C-O>:call sqlcomplete#Map("column_csv")<CR><C-X><C-O>' |
467 " The next 3 maps are only to be used while the completion window is | 484 " The next 3 maps are only to be used while the completion window is |
468 " active due to the <CR> at the beginning of the map | 485 " active due to the <CR> at the beginning of the map |
469 exec 'imap <buffer> '.g:ftplugin_sql_omni_key.'L <C-Y><C-\><C-O>:call sqlcomplete#Map("column_csv")<CR><C-X><C-O>' | 486 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'L <C-Y><C-\><C-O>:call sqlcomplete#Map("column_csv")<CR><C-X><C-O>' |
470 " <C-Right> is not recognized on most Unix systems, so only create | 487 " <C-Right> is not recognized on most Unix systems, so only create |
471 " these additional maps on the Windows platform. | 488 " these additional maps on the Windows platform. |
472 " If you would like to use these maps, choose a different key and make | 489 " If you would like to use these maps, choose a different key and make |
473 " the same map in your vimrc. | 490 " the same map in your vimrc. |
474 " if has('win32') | 491 " if has('win32') |
475 exec 'imap <buffer> '.g:ftplugin_sql_omni_key_right.' <C-R>=sqlcomplete#DrillIntoTable()<CR>' | 492 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key_right.' <C-R>=sqlcomplete#DrillIntoTable()<CR>' |
476 exec 'imap <buffer> '.g:ftplugin_sql_omni_key_left.' <C-R>=sqlcomplete#DrillOutOfColumns()<CR>' | 493 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key_left.' <C-R>=sqlcomplete#DrillOutOfColumns()<CR>' |
477 " endif | 494 " endif |
478 " Remove any cached items useful for schema changes | 495 " Remove any cached items useful for schema changes |
479 exec 'imap <buffer> '.g:ftplugin_sql_omni_key.'R <C-\><C-O>:call sqlcomplete#Map("resetCache")<CR><C-X><C-O>' | 496 exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'R <C-\><C-O>:call sqlcomplete#Map("resetCache")<CR><C-X><C-O>' |
480 endif | 497 endif |
481 | 498 |
482 if b:sql_compl_savefunc != "" | 499 if b:sql_compl_savefunc != "" |
483 " We are changing the filetype to SQL from some other filetype | 500 " We are changing the filetype to SQL from some other filetype |
484 " which had OMNI completion defined. We need to activate the | 501 " which had OMNI completion defined. We need to activate the |