I've got automatic folding enabled in my file with the following modeline
:
" vim:foldmethod=marker:foldlevel=0
I also have an autocmd like this to place the cursor where I left it:
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
endif
The problem is that if I left the cursor in the middle of a fold then my auto command will not work as desired.
What can I do to unfold the fold under the cursor on read, preferably using modeline
?
I've tried adding normal zv
to my autocmd but it didn't work.