LFrankel wrote:

I'm having some problems trying to get syntax folding working for Visual
Basic.

Simply put: I've confirmed that the regexes
"\c^\(.*'\)[EMAIL PROTECTED]" and "\c^\(.*'\)[EMAIL PROTECTED]"
work by simply searching by them with hlsearch turned on and observing that
I get the results I'm expecting. However, if I enter the following command:

syntax region function start="\c^\(.*'\)[EMAIL PROTECTED]"
end="\c^\(.*'\)[EMAIL PROTECTED]" transparent fold

...either in a syntax file or just in gVim itself, I get nothing but
problems. It doesn't seem to work at all unless I've actually cleared the
syntax, and since trying that at first it was working, then only working if
I set foldnestlevel=2, and finally not working at all (I haven't been able
to determine why; I don't think I tried anything different).

I don't mind folding solutions other than syntax, but I haven't been able to
come up with anything satisfactory since, after getting folding functions to
work, I'm intending to get subroutines and properties to fold as well
(which, as far as I know, means that folding by marks or expr won't work).

I'm using gVim 7.0 on Windows.

I haven't tried this out, but perhaps some pointers:

* order of appearance of syntax rules specifies priority, with later matches and regions having precedence * simply doing yet another match/region line does not remove the earlier syntax
* keywords have precedence over matches/regions
* once a match/region starts, other syntax rules don't apply unless they're explicitly "contained", until the
 match/region ends.

Hmm, I don't see "syn.*region.*function" in any of the three *basic*.vim syntax files that come with Vim, so I assume that you're trying to include extra syntax with one of them. Can you give some examples of the syntax you're trying to match and some you're trying not to match?
(those \(.*\)[EMAIL PROTECTED] seem peculiar to me -- what are you trying to 
avoid?).

Note that keywords have precedence over matches and regions!  For example,

do function ABC
endfunction

would not be recognized as a function because "do" is a keyword (in syntax/basic.vim).

One thing you could do is to copy basic.vim to $HOME/syntax/basic.vim and then to modify it. a) comment out nearly all lines, insert your function syntax, test to see if functions are foldable. b) re-activate lines bit by bit by uncommenting them and while trying to see if your function matching syntax is still working. You may find that you need to move the function regions
 about.

Regards,
Chip Campbell


Regards,
Chip Campbell

Reply via email to