>> Your particular situation is also going to be difficult because
>> cindent() will look at context beyond the C code you want it to look at.
>> It will essentially try to return the indent the line would have if the
>> whole file were cindented.
> 
> Hm.  Is this true?  I would have thought that it would only look up at
> the preceding line, and see what new things happened on that line...

I'm not exactly sure, but you're at least partly right, Matt. It only
looks back as far as it needs to, to determine if the preceding text
ends a statement, or something like that.

>> Solving this will be tough, and I'm not sure what approach
>> would be best. Two possible solutions I can see are both very nasty: (1)
>> writing the C indenting functionality in Vimscript yourself; or (2)
>> copying the chunks of C code into another buffer, outdenting according
>> to the current XML indent, running cindent on it, then returning the
>> appropriate indent plus the current XML indent.
> 
> A third option (which would only work if my belief about cindent only
> looking back one line is true) would be to see if the previous line
> matches /<![CDATA[/ and if so set the indent for the current line to 0,
> otherwise if you're not in a mx:Script tag return the XML indent, else
> return the cindent.

Yes, something like that may well work. Much better. I thought there
must've been something I was missing before... Just wasn't thinking
straight.

Ben.




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

Reply via email to