On 2017-12-14, 'Andy Wokula' via vim_dev wrote:
> Am 13.12.2017 um 22:43 schrieb Gary Johnson:
> >To follow up, here is what I did to fix the problematic function in
> >my plugin. I added code above and below this line, which had been
> >modifying every line in a closed fold instead of just l:lnum,
> >
> >silent exe l:lnum.'s/:.*/:\t'.strftime("%Y-%m-%d %H:%M:%S").'/'
> >
> >to open any closed fold at that line and, if necessary, re-close it.
> >
> >let l:foldclosed = foldclosed(l:lnum) > 0 if l:foldclosed exe
> >l:lnum."foldopen" endif
> >
> >silent exe l:lnum.'s/:.*/:\t'.strftime("%Y-%m-%d %H:%M:%S").'/'
> >
> >if l:foldclosed exe l:lnum."foldclose" endif
>
> Just :foldopen is not enough, it just opens one level of folds, the
> cursor line might still end up in a closed fold.
> And often it's unclear how the range is related to existing folds.
> Mostly it's better to temporarily reset 'foldenable'.
Thanks for the comments. That's one of the reasons I posted my
solution.
I wanted to preserve the state of folds I had manually opened and it
looks like 'foldenable' does that, so I'll change my code to use
that instead.
Regards,
Gary
--
--
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.