Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Folds open on save #24

Open
AmaruCoder opened this issue Jun 30, 2016 · 2 comments
Open

Folds open on save #24

AmaruCoder opened this issue Jun 30, 2016 · 2 comments

Comments

@AmaruCoder
Copy link

Is there any way to prevent the folds to open on save?

@Miesco
Copy link

Miesco commented Aug 27, 2016

AmaruCoder, I just used :mkview and :loadview to save and restore my folds to state before saving. I had a filter on my files before writing to the file that caused the current fold state to reset.

@AmaruCoder
Copy link
Author

El Paso, August 28, 2016

Dear Drew,

Thank you, very much.
Cordially,

José

On Aug 27, 2016, at 2:44 AM, Miesco [email protected] wrote:

Hi AmaruCoder, I wrote this until a fix is made. It allows folding and by nesting or not, and it does not fold or unfold on save:

let g:markdown_foldnested = 1
function MarkdownLevel()
let h = matchstr(getline(v:lnum), '^#+')
if empty(h)
return "="
else
if exists("g:markdown_foldnested") && g:markdown_foldnested == 1
return ">" . len(h)
else
return ">1"
endif
endif
endfunction
augroup markdown_fold
au!

autocmd FileType markdown setl foldexpr=MarkdownLevel()
autocmd FileType markdown setl foldmethod=expr

augroup END

You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub #24 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/ACmQ6xtyKZhGJDZRfMo20WSkmhcMdKyXks5qj_jngaJpZM4JCbTd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants