reset folding

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

reset folding

Brendan Jurd
Hello the list,

I'm currently using gVim 6.3.72 to edit PHP scripts, with foldmethod=indent.

I've found that, after heavy editing (moving functions around,
changing indent on blocks of code), the folds no longer make sense and
they need to be recalculated.

To do this, I re-issue :set foldmethod=indent, but, knowing vim, I'm
sure there must be a more elegant approach.

I looked through the help file on folding, and the closest thing I
found was 'zx', but that doesn't work properly with the "indent"
method -- specifically, it doesn't seem to ignore blank lines
correctly.

TIA

--
BJ
Reply | Threaded
Open this post in threaded view
|

RE: reset folding

Keith W. Roberts
 

> -----Original Message-----
> From: Brendan Jurd [mailto:[hidden email]]
> Sent: Tuesday, September 20, 2005 11:30 AM
> To: [hidden email]
> Subject: reset folding
>
> Hello the list,
>
> I'm currently using gVim 6.3.72 to edit PHP scripts, with
> foldmethod=indent.
>
> I've found that, after heavy editing (moving functions around,
> changing indent on blocks of code), the folds no longer make sense and
> they need to be recalculated.
>
> To do this, I re-issue :set foldmethod=indent, but, knowing vim, I'm
> sure there must be a more elegant approach.
>
> I looked through the help file on folding, and the closest thing I
> found was 'zx', but that doesn't work properly with the "indent"
> method -- specifically, it doesn't seem to ignore blank lines
> correctly.

:e! will do it.  Be sure to do :w first, though. :)

-Keith


Reply | Threaded
Open this post in threaded view
|

Re: reset folding

Brendan Jurd
Yeah, I was aware of that, but was hoping there was a less risky alternative.

Any insights on why 'zx' doesn't want to play the foldignore game?  Is
it a bug, or intended behaviour?

On 9/21/05, Keith W. Roberts <[hidden email]> wrote:

>
>
> > -----Original Message-----
> > From: Brendan Jurd [mailto:[hidden email]]
> > Sent: Tuesday, September 20, 2005 11:30 AM
> > To: [hidden email]
> > Subject: reset folding
> >
> > Hello the list,
> >
> > I'm currently using gVim 6.3.72 to edit PHP scripts, with
> > foldmethod=indent.
> >
> > I've found that, after heavy editing (moving functions around,
> > changing indent on blocks of code), the folds no longer make sense and
> > they need to be recalculated.
> >
> > To do this, I re-issue :set foldmethod=indent, but, knowing vim, I'm
> > sure there must be a more elegant approach.
> >
> > I looked through the help file on folding, and the closest thing I
> > found was 'zx', but that doesn't work properly with the "indent"
> > method -- specifically, it doesn't seem to ignore blank lines
> > correctly.
>
> :e! will do it.  Be sure to do :w first, though. :)
>
> -Keith
>
>
>
Reply | Threaded
Open this post in threaded view
|

RE: reset folding

Keith W. Roberts
Dunno.  I'm not sure how the folding works.

I would *think* syntax folding works on the fly, synching the same way as
syntax hilighting.  But I seem to recall reading that Indent folding only
works from the top of file.  Otherwise, it would be possible to
reindent/refold code that is copy/pasted.

You've probably tried zM (or zRzM) to see if they reevaluate folds on the
entire buffer.  But I'll bet that all z commands which don't actually create
a fold work off a table of folds, just so they *don't* have to reevaluate
the whole file.  Maybe that should be changed for zR and zM.

-Keith

> -----Original Message-----
> From: Brendan Jurd [mailto:[hidden email]]
> Sent: Tuesday, September 20, 2005 1:42 PM
> To: Keith W. Roberts
> Cc: [hidden email]
> Subject: Re: reset folding
>
> Yeah, I was aware of that, but was hoping there was a less
> risky alternative.
>
> Any insights on why 'zx' doesn't want to play the foldignore game?  Is
> it a bug, or intended behaviour?
>
> On 9/21/05, Keith W. Roberts <[hidden email]> wrote:
> >
> >
> > > -----Original Message-----
> > > From: Brendan Jurd [mailto:[hidden email]]
> > > Sent: Tuesday, September 20, 2005 11:30 AM
> > > To: [hidden email]
> > > Subject: reset folding
> > >
> > > Hello the list,
> > >
> > > I'm currently using gVim 6.3.72 to edit PHP scripts, with
> > > foldmethod=indent.
> > >
> > > I've found that, after heavy editing (moving functions around,
> > > changing indent on blocks of code), the folds no longer
> make sense and
> > > they need to be recalculated.
> > >
> > > To do this, I re-issue :set foldmethod=indent, but,
> knowing vim, I'm
> > > sure there must be a more elegant approach.
> > >
> > > I looked through the help file on folding, and the closest thing I
> > > found was 'zx', but that doesn't work properly with the "indent"
> > > method -- specifically, it doesn't seem to ignore blank lines
> > > correctly.
> >
> > :e! will do it.  Be sure to do :w first, though. :)
> >
> > -Keith
> >
> >
> >
>
>


Reply | Threaded
Open this post in threaded view
|

Re: reset folding

Chris Allen
In reply to this post by Brendan Jurd
On 20/09/05, Brendan Jurd <[hidden email]> wrote:
> Yeah, I was aware of that, but was hoping there was a less risky alternative.

I use ctrl-L to re-sync LaTeX folding when it breaks.  Works a treat.

HTH,
Chris Allen
Reply | Threaded
Open this post in threaded view
|

RE: reset folding

Keith W. Roberts
With what type of folding?  Syntax?  Indent?

-Keith

> -----Original Message-----
> From: Chris Allen [mailto:[hidden email]]
> Sent: Tuesday, September 20, 2005 3:56 PM
> To: [hidden email]
> Cc: Keith W. Roberts; [hidden email]
> Subject: Re: reset folding
>
> On 20/09/05, Brendan Jurd <[hidden email]> wrote:
> > Yeah, I was aware of that, but was hoping there was a less
> risky alternative.
>
> I use ctrl-L to re-sync LaTeX folding when it breaks.  Works a treat.
>
> HTH,
> Chris Allen
>
>


Reply | Threaded
Open this post in threaded view
|

Re: reset folding

Chris Allen
On 21/09/05, Keith W. Roberts <[hidden email]> wrote:
> With what type of folding?  Syntax?  Indent?

Ah, good point, syntax folding.  Sorry.

Chris Allen