So ever since folding showed up in vim I've been annoyed by some
"behaviours". I assumed they were bugs and would be fixed in the next
version, but they're still there many years later, and I'm finally
wondering if maybe others don't see them, or maybe they're not
considered bugs, or maybe I'm doing something wrong (though I don't
see how since I just :set foldmethod=indent).
So here's what I see. Do other people see them? Do they get annoyed
by them? Is there a reason they don't see them, or have a workaround
for them?
This is VIM 7.2:
:set foldmethod=indent
Now write a line, and then some indented lines under it, like
a
b
c
Now add something before 'a', hit return and tab. a b and c will all
fold up,
even though they were never folded to begin with! This is annoying
when
what you're editing suddenly folds up and disappears even though you
just
explicitly unfolded it.
Put behaviour with folding is also surprising. If you put below a
folded
region and the put text is also indented, it will join the fold, which
will
stay closed. The effect is that the text you put immediately
disappears and
you have to open the fold and hunt for it. If you enter text into a
fold with
'insert' it automatically opens, but if you enter text with put it
doesn't.
Shouldn't it open in both cases?
But it's worse than that, if you have an indent which is open, then
put
something which is indented into it, the whole thing will fold up,
even though
it was explicitly unfolded earlier. I.e. in the 'a b c' above, type
dd on 'c',
then jP to put it above 'b', the whole thing should fold up. This is
really
annoying!
This also happens if you do an undo that results in something being
added to the open fold: it closes up automatically.
Folds in indent mode also get out of sync with the buffer contents.
If you
have
a
b
c
and then append a blank line plus indented d and e, the folds won't
combine, so
you wind up with what should be one fold but is really two. This
happens all
the time when pasting stuff into functions and the result is a
function that
won't fold up. I can work around by setting foldmethod=indent again
or
switching to another buffer and back, but this seems more like a bug
than
a feature.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---