comparison runtime/ftplugin/sql.vim @ 1620:73fe8baea242

updated for version 7.2a
author vimboss
date Tue, 24 Jun 2008 21:16:56 +0000
parents d3bbb5dd3913
children 7bc41231fbc7
comparison
equal deleted inserted replaced
1619:b9740fb41986 1620:73fe8baea242
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: 3.0 3 " Version: 4.0
4 " Maintainer: David Fishburn <fishburn at ianywhere dot com> 4 " Maintainer: David Fishburn <fishburn at ianywhere dot com>
5 " Last Change: Wed Apr 26 2006 3:02:32 PM 5 " Last Change: Wed 27 Feb 2008 04:35:21 PM Eastern Standard Time
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 "
36 finish 36 finish
37 endif 37 endif
38 38
39 let s:save_cpo = &cpo 39 let s:save_cpo = &cpo
40 set cpo= 40 set cpo=
41
42 " Disable autowrapping for code, but enable for comments
43 " t Auto-wrap text using textwidth
44 " c Auto-wrap comments using textwidth, inserting the current comment
45 " leader automatically.
46 setlocal formatoptions-=t
47 setlocal formatoptions-=c
41 48
42 " Functions/Commands to allow the user to change SQL syntax dialects 49 " Functions/Commands to allow the user to change SQL syntax dialects
43 " through the use of :SQLSetType <tab> for completion. 50 " through the use of :SQLSetType <tab> for completion.
44 " This works with both Vim 6 and 7. 51 " This works with both Vim 6 and 7.
45 52
276 " \W - no characters or digits 283 " \W - no characters or digits
277 nmap <buffer> <silent> ]] :call search('\\c^\\s*begin\\>', 'W' )<CR> 284 nmap <buffer> <silent> ]] :call search('\\c^\\s*begin\\>', 'W' )<CR>
278 nmap <buffer> <silent> [[ :call search('\\c^\\s*begin\\>', 'bW' )<CR> 285 nmap <buffer> <silent> [[ :call search('\\c^\\s*begin\\>', 'bW' )<CR>
279 nmap <buffer> <silent> ][ :call search('\\c^\\s*end\\W*$', 'W' )<CR> 286 nmap <buffer> <silent> ][ :call search('\\c^\\s*end\\W*$', 'W' )<CR>
280 nmap <buffer> <silent> [] :call search('\\c^\\s*end\\W*$', 'bW' )<CR> 287 nmap <buffer> <silent> [] :call search('\\c^\\s*end\\W*$', 'bW' )<CR>
281 vmap <buffer> <silent> ]] /\\c^\\s*begin\\><CR> 288 vmap <buffer> <silent> ]] :<C-U>exec "normal! gv"<Bar>call search('\\c^\\s*begin\\>', 'W' )<CR>
282 vmap <buffer> <silent> [[ ?\\c^\\s*begin\\><CR> 289 vmap <buffer> <silent> [[ :<C-U>exec "normal! gv"<Bar>call search('\\c^\\s*begin\\>', 'bW' )<CR>
283 vmap <buffer> <silent> ][ /\\c^\\s*end\\W*$<CR> 290 vmap <buffer> <silent> ][ :<C-U>exec "normal! gv"<Bar>call search('\\c^\\s*end\\W*$', 'W' )<CR>
284 vmap <buffer> <silent> [] ?\\c^\\s*end\\W*$<CR> 291 vmap <buffer> <silent> [] :<C-U>exec "normal! gv"<Bar>call search('\\c^\\s*end\\W*$', 'bW' )<CR>
285 292
286 293
287 " By default only look for CREATE statements, but allow 294 " By default only look for CREATE statements, but allow
288 " the user to override 295 " the user to override
289 if !exists('g:ftplugin_sql_statements') 296 if !exists('g:ftplugin_sql_statements')
341 \ "', 'W')" 348 \ "', 'W')"
342 let b:comment_skip_back = "call search('". 349 let b:comment_skip_back = "call search('".
343 \ '^\\(\\s*'.b:comment_leader.'.*\\n\\)\\@<!'. 350 \ '^\\(\\s*'.b:comment_leader.'.*\\n\\)\\@<!'.
344 \ "', 'bW')" 351 \ "', 'bW')"
345 " Move to the start and end of comments 352 " Move to the start and end of comments
346 exec 'nnoremap <silent><buffer> ]" /'.b:comment_start.'<CR>' 353 exec 'nnoremap <silent><buffer> ]" :call search('."'".b:comment_start."'".', "W" )<CR>'
347 exec 'nnoremap <silent><buffer> [" /'.b:comment_end.'<CR>' 354 exec 'nnoremap <silent><buffer> [" :call search('."'".b:comment_end."'".', "W" )<CR>'
348 exec 'vnoremap <silent><buffer> ]" /'.b:comment_start.'<CR>' 355 exec 'vnoremap <silent><buffer> ]" :<C-U>exec "normal! gv"<Bar>call search('."'".b:comment_start."'".', "W" )<CR>'
349 exec 'vnoremap <silent><buffer> [" /'.b:comment_end.'<CR>' 356 exec 'vnoremap <silent><buffer> [" :<C-U>exec "normal! gv"<Bar>call search('."'".b:comment_end."'".', "W" )<CR>'
350 357
351 " Comments can be of the form: 358 " Comments can be of the form:
352 " /* 359 " /*
353 " * 360 " *
354 " */ 361 " */