Re: automatically opening folds
This code works perfectly :O)
However the foldmethod was not set by a modeline but in the filetype plugin
(which is maybe set late also in file opening stage, i'm not too sure).
Anyway, thank you very very much... one thing less on the path to the
absolutely-perfect-for-me editor :O)
On Sunday 29 December 2002 22:39, Bram Moolenaar wrote:
> I assume the 'foldmethod' is being set by a modeline. In that case you
> need to execute the "zv" command with a BufWinEnter autocommand, but
> only when the `" command was used. That's because the BufReadPost event
> is triggered before the modelines are processed.
> This code should do it:
> autocmd BufReadPost *
> \ if line("'\"") > 0 && line("'\"") <= line("$") |
> \ exe "normal g`\"" |
> \ let b:doopenfold = 1 |
> \ endif
> " Need to postpone using "zv" until after reading the modelines.
> autocmd BufWinEnter *
> \ if exists("b:doopenfold") |
> \ unlet b:doopenfold |
> \ exe "normal zv" |
> \ endif