On Mon, 24 Jul 2006 23:48:12 -0500, Thore B. Karlsen <[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!

I spoke too soon. I tested it on another file that is 2500 lines long,
and it is still unbearably slow. It gets worse towards the end of the
file, where it can still take seconds for characters to show up when I
type them. I think I'll have to fire up vim in a profiler to see what
is causing this slowness, because if this system can compress dozens
of channels of video in realtime without breaking a sweat it seems
strange that inserting a character in a smallish text file would be a
problem.

-- 
Be seeing you.

Reply via email to