Changesqlcase.vim is a project mainly written in Vim Script, it's free.
Upper case sql keywords from a visual mode selection.
This is a mirror of http://www.vim.org/scripts/script.php?script_id=869
Description: This plugin is a function that wraps around a big substitution expression. The goal is to be able up upper case sql keywords from a visual selection. It is quite similar to this script:
http://www.vim.org/scripts/script.php?script_id=305
which uses insert mode abbreviations to capitalize as you type. My script will be useful if you need to clean up existing scripts or if you are programming in another language and want to format sql inside of a string variable.
The sql keyword list is taken from the postgresql 7.4 docs:
http://www.postgresql.org/docs/current/static/sql-keywords-appendix.html#KEYWORDS-TABLE
Please send a patch to include keywords specific to the database you are working with.
Installation:
Place this script in your ~/.vim/plugin/ directory or source from your vimrc file. To use the script create a visual map:
vmap
Customization:
Todo:
Bugs:
As noted in the vim manual |10.3|:
When using Visual mode to select part of a line, or using CTRL-V to select a block of text, the colon commands will still apply to whole lines. This might change in a future version of Vim.
So if you select just the string in side of the quotes in the following example:
test="select * from example" { dont update me }
the word 'update' after the end quote will also change case.