sponsor Vim development Vim logo Vim Book Ad

sql_iabbr.vim : Makes all your favorite SQL keywords uppercase automatically.

 script karma  Rating 86/40, Downloaded by 5418  Comments, bugs, improvements  Vim wiki

created by
Michael Brailsford
script type
With this ftplugin you can type "create table foo (foo_id int);" and get "CREATE TABLE foo (foo_id INT);".  It is based on both sql.vim and the output from postgresql's \dT command while in psql.  That makes it a tad bit tailored to postgresql, but it will work with any SQL compliant dbms.  Please note that I am not an SQL wizard.  I just know how to copy and paste and use ":%s///".  :)  Enjoy!  Comments are welcome.  Many thanks to Hari Krishna Dara for improving this plugin and making it generally more useful.
install details
Just stick in ~/.vim/ftplugin/sql, and you're good to go.  

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
sql_iabbr.vim 1.5 2002-11-13 6.0 Hari Krishna Dara I added ^Xu map to undo the previous immediate capitalization. This will work
correctly only when you are still next to the word for which you want to
undo capitaliation and you have not left the insert mode since the
capitaliation was done.
sql_iabbr.vim 1.4 2002-11-01 6.0 Hari Krishna Dara - Added Zak Beck's contribution to ignore the words inside constants too.
- Also for Vikas Agnihothri, exposed the function that expands the abbreviations conditionally as a global function. You can now use SqlIab_ReplaceConditionally() function anywhere in your scripts to add new abbreviations for sql files.
sql_iabbr.vim 1.3 2002-09-19 6.0 Hari Krishna Dara I have modified Michael's script to ignore the abbreviations if the same words are used inside comments. Since there is no other difference, you can even download the 1.2 version if you don't like this. Thanks to Michael for allowing me to upload into his space.
sql_iabbr.vim 1.2 2002-07-03 6.0 Michael Brailsford Made all the abbreviations local to the buffer.  Now when editing sql and some other language in the same vim instance, typing "create" in the non-sql window will not be changed to "CREATE".
sql_iabbr.vim 1.1 2002-06-10 6.0 Michael Brailsford Added a few keywords that I found missing as I used the script.
sql_iabbr.vim 1.0 2002-05-29 6.0 Michael Brailsford Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.