KKde wrote:
> Hi all,
> In our projects I write lot of sql's in shell script using slqplus
> command. Problem is sql syntax is not highlighted and it's difficult
> to read for me. The sql's are feeded to sqlplus using heredoc's.
>
> 1. Does anyone tried to enable sql syntax in shell script???
> 2. I modified sh syntax file to include sql syntax file into cluster.
> This isn't working because the sql's are in heredoc operator and all
> are getting heredoc higlights. I thought of to add sql cluster in
> contains list of heredoc but that will messup the places where sql's
> are not present in heredocs
> Can anyone suggest better solution??
>   
Hello!

To get sql into heredocs for sh, may I suggest:

* copying .../syntax/sh.vim  ~/.vim/syntax
  This will make your personal copy of sh.vim dominant.  Modify it as 
suggested below.

* modifying shHereDoc syntax statements to contain shSqlScript (there 
are quite a few, but they're together)
  examples:

    syn region shHereDoc matchgroup=shRedir fold 
start="<<\s*\z(\S*\)"        matchgroup=shRedir end="^\z1\s*$"    
contai...@shdblquotelist,@shSqlScript
    syn region shHereDoc matchgroup=shRedir fold 
start="<<\s*\"\z(\S*\)\""        matchgroup=shRedir end="^\z1\s*$" 
contai...@shsqlscript

  The first example shows where I added @shSqlScript to a syntax line 
already having a contains=...,
  the second example shows where I added contai...@shsqlscript to a line 
not already having that "contains" construct.

*  you need a start and stop pattern.  I don't know what's appropriate, 
so I've just made a couple up: <SQL> ... </SQL>

    syn include @shSqlScript [PATH TO SQL SYNTAX HERE]
    syn region shSqlRegion fold start=+<SQL>+ end=+</SQL>+    
contai...@shsqlscript

   You also need to fill out the [PATH TO SQL SYNTAX HERE], too, of course.

Regards,
Chip Campbell


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to