Tuesday, October 19, 2010

Re: question re: loading folded buffers into new windows

On Oct 18, 1:59 pm, hsitz <hes...@gmail.com> wrote:
> I work with files with folds using foldmethod=expr and a fairly
> complicated foldexpr.  The configuration of open and closed folds for
> a buffer is local to a window, not the buffer.  This is great, except
> that it can cause a slowdown as the foldexpr is (re-)evaluated for the
> entire buffer when a hidden buffer is loaded into a window.
>
> Here's the behavior I'm seeing:
>
> 1.  Buffer is loaded into a window:  Takes severals seconds before
> text appears as foldexpr is evaluated for hte entire buffer.
>
> 2.  Same buffer is now split into two windows.  Immediate appearance
> of buffer in the split window.  Seems to starts with same fold
> configuration as original window, doesn't reevaluate, but folds in the
> two windows are independent from point of split on.
>
> 3.  Switch to a new tab and open a window showing buffer that is
> visible in a window on the previous tab.    Although the buffer is
> open in a window (albeit on a different tab), I experience the same
> slowdown as when the buffer is loaded into a window for the first
> time.  I.e., buffer does not take folds of existing window on
> different tab as its starting point.
>
> My question is this:  If I want to open a window on the current tab
> for a buffer that is already open in a window on a different tab, is
> there any way to avoid the slowness of loading it?  I would like for
> it to appear immediately with same fold configuration as window in the
> other tab, in same way as a split of the buffer in the same window
> appears immediately.  Is there any way to get that behavior?
>

I think the reason it happens so quickly is that :split with no
arguments is special. It has (documented) inconsistencies in other
areas too, for example BufWinEnter does not fire. I have no idea if it
will work, but maybe :tab split will do the same thing?

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: