On Do, 16 Feb 2012, Marc van Dongen wrote:
> I've just configured vim for folds and I have two questions.
>
> The first question is as follows. When I use the opening brace ({} or
> closing brace (}) to more to the previous paragraph or the next
> paragraph, my folds sometimes automatically open. I suspect this may
> be because there are paragraphs in the fold. Is there a way to turn
> this automatically opening/closing off? E.g. when the cursor is just
> after a closed fold (at fold nesting level X), then I'd like the
> opening brace to move the cursor to just before the closed fold (at
> fold nesting level X).
I think, you almost get what you want, if you set
:set foldopen-=block
This will make the { movements not open the folds. But it won't move to
before the closed fold, but stays on the closed fold, where the
paragraph is.
> The second question has got to do with ``entering'' a fold. Years ago
> I used an occam folding editor that let you enter a fold. Basically,
> this let you edit the contents of the fold in a fresh screen. You
> could only edit what was outside the fold if you left the fold. Is
> there an equivalent of this facility in vim? (I read the manual pages
> but I may have missed this.)
Not exactly possible. Use one of the many NarrowRegion plugins
available, e.g. my NrrwRgn
http://www.vim.org/scripts/script.php?script_id=3075
which opens a selected range of lines in a new buffer and marks the
original buffer non-modifiable.
regards,
Christian
Hi Christian,
: I think, you almost get what you want, if you set
: :set foldopen-=block
: This will make the { movements not open the folds. But it won't move to
: before the closed fold, but stays on the closed fold, where the
: paragraph is.
Perfect. Seems to do exactly what I want.
: > The second question has got to do with ``entering'' a fold. Years ago
: > I used an occam folding editor that let you enter a fold. Basically,
: > this let you edit the contents of the fold in a fresh screen. You
: > could only edit what was outside the fold if you left the fold. Is
: > there an equivalent of this facility in vim? (I read the manual pages
: > but I may have missed this.)
:
: Not exactly possible. Use one of the many NarrowRegion plugins
: available, e.g. my NrrwRgn
: http://www.vim.org/scripts/script.php?script_id=3075
: which opens a selected range of lines in a new buffer and marks the
: original buffer non-modifiable.
Thanks. I may see if I can implement it myself.
Regards,
Marc van Dongen
* Christian Brabandt [2012-02-17 10:25:47 +0100]: