Wednesday, January 18, 2017

Re: Control redraws

For what it's worth, this appears to have been reported on the vim github as an issue. They weighed "feature or bug?" and decided on the former. https://github.com/vim/vim/issues/536

That also pointed to the most effective workaround I found: managed to augment my mappings by first doing :set fdm=manual, then afterward doing :set fdm=expr (or syntax as the case may be). It still has to recalculate the folds which causes a visible pause, but this is for sure a big improvement.


On Tue, Jan 17, 2017 at 5:52 PM, John Passaro <john.a.passaro@gmail.com> wrote:
Hi list,

I frequently use commands like ':move+1' via shortcuts (thanks tpope/vim-unimpaired !). I've noticed that when I have folds on, after the :move command, all folds in sight tend to be closed.

My hypothesis is that the :move command somehow triggers something like the zX command (i.e. undo manual foldopens/closes, reapply foldlevel, recalculate folds), and since my foldlevel is usually 0 this causes all the folds to be closed.

Does anything document this? Are there other commands for which this also happens? Most importantly: is there any way to control it? It's a bit of a hindrance having to re-open the fold I'm in; it would be nice if this process would at least do something like zv after the folds are recalculated, or zx instead of zX.

Usually the help files are very informative, but what I've found doesn't quite explain this behavior. For what it's worth, I looked at :autocmd TextChanged but it outputs nothing.

Thanks in advance for any pointers!

John Passaro

P.S. Here's a reproducible example. On the following text, built-in html syntax creates folds from lines 1-5 and 8-12:
<div
    id="you"
    title="thing"
    class="hello"
    >
</div>

<div
    id="you2"
    title="person"
    class="hello"
    >
</div>

I open both folds and type :3move4. The text changes as expected but suddenly both folds are closed again. This happens when I open without vimrc so I know it's not one of my settings. The command without vimrc is a little unusual, in case you want to reproduce:
vim -u NONE +"syntax on" +"set fdm=syntax" +"e fold_example.html"

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment