LaTeX-Box-Team / LaTeX-Box

Lightweight Toolbox for LaTeX - New Official repository
http://www.vim.org/scripts/script.php?script_id=3109
GNU General Public License v3.0
396 stars 66 forks source link

Add support for on demand folding #205

Closed adament closed 10 years ago

adament commented 10 years ago

If this is activated vim only recalculates fold upon user request. Hence this should make editing large files a bit easier since it no longer slows down exiting insert mode.

lervag commented 10 years ago

Seems like a good idea. Thanks!

Just one thing: I've been working on big files several times (up to about 100 pages theses and reports), and I really don't experience the lag that may be several seconds long after exiting insert mode. It would be interesting to see an example of this.

adament commented 10 years ago

I have a noticable lag(so probably somewhere around 0,5-1 second) on a 30 page, ~2000 line document on my desktop(i7-4770) and it felt like a few seconds on my four year old laptop(I counted to around 4-5). I have just copied and pasted the main contents 9 times, to simulate a file of 10 times the length and I measured input mode exit time to 4 seconds on my desktop. I run vim 7.4.373 on Arch Linux.

I have uploaded the document here: http://adament.net/dela.tex.

lervag commented 10 years ago

Thanks! I notice the delay now, even though it is only in the order of 0.5 seconds (on a chromebook c720p, dual core Intel Celeron 2955U @ 1.4 GHz). Still, I think I might like your approach better than the automatic! Thanks!

lervag commented 10 years ago

Update: I hope you don't mind that I copied your idea to vim-latex.

Konfekt commented 10 years ago

Have a look at https://github.com/Konfekt/FastFold

Konfekt commented 10 years ago

Have a look at https://github.com/Konfekt/FastFold

adament commented 10 years ago

Oh I hadn't seen your plugin I also considered refolding on saves but I think I save more often than I refold. Lervags idea of remapping zx is really neat, no need to introduce a new extraneous mapping.

lervag commented 10 years ago

@Konfekt FastFold seems interesting. Should have known about it earlier, though. I feel we already have a working good method in LaTeX-Box as per now (at least things work well for my sake).

@adament Thanks, I found it more natural to just remap zx instead of creating new mapping. Might make that change to LaTeX-Box as well when I get the time.

Konfekt commented 10 years ago

Yep, that's another idea to update on invoking one of the fold maps starting with z... I found it too intrusive for a plugin though to remap all of them.

I had the same problem as the thread opener that there was a one second lag when leaving insert mode. This is discussed on the wikia page.

Even in small tex documents. Perhaps due to the conceal feature.

lervag commented 10 years ago

Ah, ok, I don't use the conceal feature.

I don't remap all the z mappings, only zx. zx is supposed to refresh and recalculate folds, so it only makes sense to remap it to ensure that the folds are really recalculated.

adament commented 10 years ago

Perhaps zX too since it's also supposed to recalculate folds?

Den 25/07/2014 kl. 08.05 skrev Karl Yngve Lervåg notifications@github.com:

Ah, ok, I don't use the conceal feature.

I don't remap all the z mappings, only zx. zx is supposed to refresh and recalculate folds, so it only makes sense to remap it to ensure that the folds are really recalculated.

— Reply to this email directly or view it on GitHub.

lervag commented 10 years ago

Yes, that's right.