Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Version 6.00

NF: When formatting INSERT statements, the sqlutil_align_comma is also respected to place each column on a newline.

NF: When formatting UPDATE statements and sqlutil_align_comma is set comments at the end of the line were removed (Rodrigo Laporte).
  • Loading branch information...
commit 566184530da81aa05ae4ac4ba6cf5034292a9b89 1 parent 8feea5b
dfishburn dfishburn authored committed
17 autoload/SQLUtilities.vim
View
@@ -1,8 +1,8 @@
" SQLUtilities: Variety of tools for writing SQL
" Author: David Fishburn <dfishburn dot vim at gmail dot com>
" Date: Nov 23, 2002
-" Last Changed: 2012 Feb 24
-" Version: 5.0.0
+" Last Changed: 2012 Oct 09
+" Version: 6.0.0
" Script: http://www.vim.org/script.php?script_id=492
" License: GPL (http://www.gnu.org/licenses/gpl.html)
"
@@ -22,7 +22,7 @@ if v:version < 700
echomsg "SQLUtilities: Version 2.0.0 or higher requires Vim7. Version 1.4.1 can stil be used with Vim6."
finish
endif
-let g:loaded_sqlutilities_auto = 500
+let g:loaded_sqlutilities_auto = 600
" Turn on support for line continuations when creating the script
let s:cpo_save = &cpo
@@ -919,7 +919,7 @@ endfunction
function! s:SQLU_WrapAtCommas()
let linenum = line("'y+1")
- let sql_keywords = '\<\%(select\|set\|into\|from\|values\)\>'
+ let sql_keywords = '\<\%(select\|set\|into\|from\|values\|insert\)\>'
" call Decho(" Before column splitter 'y+1=".line("'<").
" \ ":".col("'<")." 'z-1=".line("'>").":".col("'>"))
@@ -936,12 +936,15 @@ function! s:SQLU_WrapAtCommas()
silent! exec "normal! jmek"
let saved_linenum = linenum
- let index = match(getline(linenum), '[,(]')
+ " let index = match(getline(linenum), '[,(]')
+ " Find the first , or (
+ let index = match(getline(linenum), (g:sqlutil_align_comma==1?'[,(]':'[,]'))
while index > -1
- " Go to character
+ " Go to the , or (
call cursor(linenum, (index+1))
- " Make sure the paran is not a string
+ " Assuming syntax is on, check to ensure the , or (
+ " is not a string
if getline(linenum)[col(".")-1] == '(' &&
\ synID(line("."),col("."),1) == 0
" if searchpair( '(', '', ')', '' ) > 0
10 doc/SQLUtilities.txt
View
@@ -1,9 +1,9 @@
*SQLUtilities.txt* For Vim version 7.0.
-Author: David Fishburn February 10, 2012
+Author: David Fishburn October 10, 2012
SQLUtilities: Variety of tools for working with SQL
-Version: 5.0.0
+Version: 6.0.0
Homepage: http://www.vim.org/scripts/script.php?script_id=492
Feedback: David Fishburn <dfishburn dot vim at gmail dot com>
@@ -855,6 +855,12 @@ database. See |sqlutil-complementary-plugins| for more details.
==============================================================================
7. History *sqlutil-history*
+ 6.0.0: October 10, 2012:
+ NF: When formatting INSERT statements, the sqlutil_align_comma
+ is also respected to place each column on a newline.
+ NF: When formatting UPDATE statements and sqlutil_align_comma is set
+ comments at the end of the line were removed (Rodrigo Laporte).
+
5.0.0: February 10, 2012:
NF: Now an extra check is made for the Align plugin. If not
found when attempting to format a SQL statement a friendly
6 plugin/SQLUtilities.vim
View
@@ -1,8 +1,8 @@
" SQLUtilities: Variety of tools for writing SQL
" Author: David Fishburn <dfishburn dot vim at gmail dot com>
" Date: Nov 23, 2002
-" Last Changed: 2012 Feb 24
-" Version: 5.0.0
+" Last Changed: 2012 Oct 09
+" Version: 6.0.0
" Script: http://www.vim.org/script.php?script_id=492
" License: GPL (http://www.gnu.org/licenses/gpl.html)
"
@@ -18,7 +18,7 @@
if exists("g:loaded_sqlutilities")
finish
endif
-let g:loaded_sqlutilities = 500
+let g:loaded_sqlutilities = 600
" Turn on support for line continuations when creating the script
let s:cpo_save = &cpo
Please sign in to comment.
Something went wrong with that request. Please try again.