Friday, January 28, 2011

Re: Substitute within a highlight group.

On 1/18/2011 2:40 AM, sergio wrote:
On 01/18/2011 05:55 AM, David Fishburn wrote:

<GOTO zone serial>
   ^^^^^^^^^^^^^^^^^^
:SRChooseHiGrp

You simply run those commands from within your script.
Have you tried it?
No. Because I don't know how to select zoneSerial group from script. The first
action that I need to do it is put my cursor to serial group. I do this with my
←↓→↑ keys. And than I say SRChooseHiGrp to select it. I can do SRChooseHiGrp
from script, but I can't do the first action from script.

SRSearch optionally takes parameters.

So you can do something like this:
SRSearch vimFuncName

SRSearch vimF<Tab> to complete the names.

Obviously, the list of names varies based on what type of file you are editing and what syntax objects are already available.

So, if you cursor keyed to zoneSerial Group, and ran:
SRChooseHiGrp

The output displayed is:
SRHIGrp - Group ID: 270 Name: vimFuncName

This means in your script, you can do:
SRSearch VimFuncName


For a new feature, I think making that function publicly available like this:

if( SRSearch('vimFuncName') > 0 then ...

Might be useful so that the script has some feedback that something was found. 
What you have to do right now is save the current line and column position:
        let curcol    = col(".")
        let curline   = line(".")

Call SRSearch, then check to see if the current column position has changed.  If so, assume the find was successful.

HTH,
Dave



No comments:

Post a Comment