Issue #42 new

Slowdown in files with foldmethod=expr

Anonymous created an issue

In Vim 7.3 (patch 346, most likely all of 7.3 patchlevels) In files with foldmethod=expr, popups create a slow down for some reason; even if the file is fairly small (50 lines+ or less, depending on number of words, etc).

This can be fixed by setting up autocommands to switch to manual folding when entering insert mode and switch back when going back to normal mode:

:au InsertEnter .potl if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif :au InsertLeave,WinLeave .potl if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif

It would probably be good to add this to documentation...

  • Andrei

Comments (1)

  1. Anonymous

    Sorry should be 2 lines:

    :au InsertEnter *.potl if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif

    :au InsertLeave,WinLeave *.potl if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif

  2. Log in to comment