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

Callback exiting :Gdiff to restore folds #194

Open
tylerball opened this issue Apr 20, 2012 · 1 comment
Open

Callback exiting :Gdiff to restore folds #194

tylerball opened this issue Apr 20, 2012 · 1 comment
Labels
enhancement New feature or request

Comments

@tylerball
Copy link

I use the following autocommands to save my open and closed folds in files.

au BufWinLeave          ?* silent! mkview!
au BufWinEnter,BufRead  ?* silent! loadview

Of course, vimdiff resets the folding and this is as close as I can get to restoring after closing :Gdiff:

au BufWinLeave fugitive://* silent! loadview

But this doesn't work when you <C-W><C-O> from the original buffer for example. Is there a callback or
something I could watch for to achieve this?

I believe it might help with #128 as well.

@tylerball
Copy link
Author

This works a lot better, but I still need to manually :loadview after exiting Gdiff

function! SaveFolds()
    let match = matchstr(bufname('%'), '^\(\(fugitive.*\)\@!.\)*$')
    if !empty(match)
        au! BufWinLeave silent mkview!
        au! BufWinEnter silent loadview
        silent loadview
    endif
endfunction
au BufReadPost * call SaveFolds()

@tpope tpope added the enhancement New feature or request label Aug 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants