On Tue, 25 Jul 2006 10:45:27 +1000 (EST), Peter Hodge
<[EMAIL PROTECTED]> wrote:
>Hi Thore,
>
>I've never tried folding like this before, and unfortunately I don't have time
>to try out this 'optimized' version, but it may work faster for you (I've just
>replaced the regex matches with stridx and rearranged the code flow):
>
> set foldexpr=GetFoldLevel()
>
> function! GetFoldLevel()
> let line_text = getline(v:lnum)
>
> let left_idx = (stridx(line_text, '{') >= 0)
> let right_idx = (stridx(line_text, '}') >= 0)
>
> if left_idx
> if ! right_idx
> return 'a1'
> endif
> elseif right_idx
> return 's1'
> endif
>
> return '='
> endfunction
Thanks! I did a quick test, and that does appear to speed it up. One
of the files that was giving me problems before is now fast enough to
work in. There's still a slight latency when I type, but it's much
better. I'll do some more testing to see how it works in other files,
but this looks promising!
--
Be seeing you.