Re: Fixing cweb.vim
On Sat, Sep 02, 2006 at 01:36:06AM +0300, Ilya wrote: Benji Fisher wrote: On Fri, Sep 01, 2006 at 09:36:55AM +0300, Ilya wrote: David Brown wrote: [...] However, tex.vim frequently will enclose large sections of the document within a region and the cweb.vim which the webCRegion is not part of. I think I can fix this by adding an appropriate containedin=... field to the definition of webCRegion. What I'm having difficulty with is figuring out what to put there. Is there a way of finding out what region a given part of the buffer is in? From :help synID Example (echoes the name of the syntax item under the cursor): :echo synIDattr(synID(line(.), col(.), 1), name) IIUC, synIDattr() always returns a syn-match or syn-keyword group. It does not tell you whether you are in a syn-region. HTH --Benji Fisher It does return region names for me. So it does, but only if there is no active match nor keyword at the cursor. What I should have said is that synIDattr() (or maybe I should say synID()) reports only the innermost syntax item at the cursor. For example, :help r :normal 6j0 :echo synIDattr(synID(line(.), col(.), 1), name) reports helpLesdBlank but does not mention that this syn-match (defined with contained) is inside a helpExample syn-region. (Verify this by moving the cursor to the first non-blank on the lins.) In brief, synID() *sometimes* reports the current syn-region, and I do not think this is good enough for David Brown's purposes. HTH --Benji Fisher
Re: Fixing cweb.vim
On Fri, Sep 01, 2006 at 09:36:55AM +0300, Ilya wrote: David Brown wrote: [...] However, tex.vim frequently will enclose large sections of the document within a region and the cweb.vim which the webCRegion is not part of. I think I can fix this by adding an appropriate containedin=... field to the definition of webCRegion. What I'm having difficulty with is figuring out what to put there. Is there a way of finding out what region a given part of the buffer is in? From :help synID Example (echoes the name of the syntax item under the cursor): :echo synIDattr(synID(line(.), col(.), 1), name) IIUC, synIDattr() always returns a syn-match or syn-keyword group. It does not tell you whether you are in a syn-region. HTH --Benji Fisher
Re: Fixing cweb.vim
Benji Fisher wrote: On Fri, Sep 01, 2006 at 09:36:55AM +0300, Ilya wrote: David Brown wrote: [...] However, tex.vim frequently will enclose large sections of the document within a region and the cweb.vim which the webCRegion is not part of. I think I can fix this by adding an appropriate containedin=... field to the definition of webCRegion. What I'm having difficulty with is figuring out what to put there. Is there a way of finding out what region a given part of the buffer is in? From :help synID Example (echoes the name of the syntax item under the cursor): :echo synIDattr(synID(line(.), col(.), 1), name) IIUC, synIDattr() always returns a syn-match or syn-keyword group. It does not tell you whether you are in a syn-region. HTH --Benji Fisher It does return region names for me.
Re: Fixing cweb.vim
David Brown wrote: A.J.Mechelynck wrote: David Brown wrote: What I'm having difficulty with is figuring out what to put there. Is there a way of finding out what region a given part of the buffer is in? I'm not a specialist of these matters; but try help completion on synID Well, I did figure out how to get cweb working, by adding the line: syntax cluster texFoldGroup add=webCpart to cweb.tex. I figured this out by tracing through tex.vim by hand and by finding a group that nearly everything included. I still don't know how to debug these, but at least I got things working. That's the folding support stuff. Folks wanted to have syntax-based folding for LaTeX for things like sections, subsections, chapters, etc. Hence, these things had to be in foldable regions. Glad you figured it out! Chip Campbell
Fixing cweb.vim
I'm trying to get cweb.vim to work better, and am not sure how to go about this. Most of a cweb file is regular TeX (or LaTeX), with some occasional regions that are C code. The way it is implemented now, works with simple constructs. However, tex.vim frequently will enclose large sections of the document within a region and the cweb.vim which the webCRegion is not part of. I think I can fix this by adding an appropriate containedin=... field to the definition of webCRegion. What I'm having difficulty with is figuring out what to put there. Is there a way of finding out what region a given part of the buffer is in? Thanks, David Brown
Re: Fixing cweb.vim
David Brown wrote: I'm trying to get cweb.vim to work better, and am not sure how to go about this. Most of a cweb file is regular TeX (or LaTeX), with some occasional regions that are C code. The way it is implemented now, works with simple constructs. However, tex.vim frequently will enclose large sections of the document within a region and the cweb.vim which the webCRegion is not part of. I think I can fix this by adding an appropriate containedin=... field to the definition of webCRegion. What I'm having difficulty with is figuring out what to put there. Is there a way of finding out what region a given part of the buffer is in? Thanks, David Brown I'm not a specialist of these matters; but try help completion on synID i.e., (optional) :set wildmenu (then) :help synIDTab (or):help synIDCtrl-D Best regards, Tony.
Re: Fixing cweb.vim
A.J.Mechelynck wrote: David Brown wrote: What I'm having difficulty with is figuring out what to put there. Is there a way of finding out what region a given part of the buffer is in? I'm not a specialist of these matters; but try help completion on synID Well, I did figure out how to get cweb working, by adding the line: syntax cluster texFoldGroup add=webCpart to cweb.tex. I figured this out by tracing through tex.vim by hand and by finding a group that nearly everything included. I still don't know how to debug these, but at least I got things working. Thanks, David