Hi Tim!

On Sa, 17 Mär 2012, Tim Chase wrote:

> On 03/17/12 13:12, [email protected] wrote:
> >On Sun, Mar 18, 2012 at 1:27 AM, Tim Chase<[email protected]>  wrote:
> >>  :autocmd BufWrite * %s/\c\<\(select\|insert\|
> >>update\|create\|where\|from\|**like\|group\_s\+by\|order\_s\+
> >>by\|having\)\>/\U&/g
> >>
> >>Adjust for whatever SQL keywords you want to include.
> >
> >There is a syntax file in vim which is sqlanywhere.vim, it will highlight a
> >lot of keyword. So the smart way is to make uppercase for all of those
> >keywords.
> 
> yes, there are a lot of SQL keywords, and optionally functions if
> you want to highlight those.  It would be handy to have something
> like
> 
>  :autocmd BufWrite * exec
> '%s/\c\<\('.join(synkeywords('sqlKeyword'), '\|').'\)\>/\U&/g'
> 
> but I don't know of any "synkeywords()" sort of function.

:%s/\<\w\+\>/\=synIDattr(synID(line('.'),col('.'),1), 
'name')=~'sql\%(keyword\|operator\|statement\)'?toupper(submatch(0)):submatch(0)/g

regards,
Christian

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to