Tuesday, January 17, 2012

Re: Keyword case

When you put your cursor on each one and run:
:SRChooseHiGrp
and
:SRChooseHiGrp!

Does it still report the same Group ID?


On 1/17/2012 5:40 AM, Clark, David wrote:

Hi David,

 

No they are the same colour. :(

 

I’m still in the early days of learning what Vim can do for me.

 

Can I user a region to identify an SQL statement e.g.

 

syntax region openroadSQLRgn start="SELECT" end=";" contains=ALL

 

Then look for a string within that region and set it’s case accordingly, e.g.

 

:silent! %s/\<begin\>/\=synIDattr(synID(line('.'),col('.'),1),'name')=~'openroadSQLRgn'?'BEGIN':submatch(0)/g

 

This doesn’t work so I’m obviously doing something wrong…

 

Would welcome any help on this…

 

Cheres

Dave

 

-----Original Message-----
From: vim_use@googlegroups.com [mailto:vim_use@googlegroups.com] On Behalf Of David Fishburn
Sent:
17 January 2012 03:30
To: vim_use@googlegroups.com
Cc: <vim_use@googlegroups.com>
Subject: Re: Keyword case

 

Are the different begin and ends coloured differently?

 

You can use the search and replace by highlight group (SrchRplcHiGrp.vim) to do this.

 

Download off vim.org

Ask for help if you need it. 

--

David Fishburn

 


On Jan 16, 2012, at 7:30 AM, "Clark, David" <dclark@aviagen.com> wrote:

Hi All,

 

I’ve now got my OpenROAD code to set all keywords to Pascal case – except for SQL keywords which are in uppercase.

 

One thing I can’t resolve is that I have certain keywords that exist both inside and outside of an SQL statement. Here’s an example…

 

On Click RetrieveBtn =

Begin

            …

            SELECT LocalVar = table_value

            FROM    main_table

            WHERE table_value BETWEEN 1 AND 100

            BEGIN

                        Field(RetrieveList).ValueList.ChoiceItems[Row].EnumValue = LocalVar;

                        Row = Row + 1;

            END;

            …

 

End

 

Ideally I want ‘begin’ and ‘end’ to be in uppercase when part of an SQL statement but Pascal case when not.

 

Can I define a region as, e.g. starting with ‘SELECT’ and ending with ‘END;’, and use this region within the substitute command to set the appropriate keywords to uppercase?

 

Hope this makes sense…

 

Thanks

Dave

 

Dave Clark

Analyst Programmer

Aviagen Ltd

Newbridge Edinburgh EH28 8SZ

': +44 (0) 131 527 8165

*: dclark@aviagen.com



No comments: