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

folding reverts to pre-goyo stage #28

Closed
rafaeln opened this issue Apr 28, 2014 · 5 comments
Closed

folding reverts to pre-goyo stage #28

rafaeln opened this issue Apr 28, 2014 · 5 comments

Comments

@rafaeln
Copy link

rafaeln commented Apr 28, 2014

When I enter goyo mode, unfold or fold some stuff, and then leave goyo mode, the folding comes back to what it was before I entered goyo mode.

@junegunn
Copy link
Owner

This one is tricky. Actually Goyo command opens the current buffer in a separate window in a new tab. Your modifications to the folds are then only local to this new window. In order to apply the updated folds back to the original window, Goyo has to save the information using mkview command. However the command seems to have backward compatibility issue, in other words, it works differently on older versions on Vim. So I'm not sure if I want to implement this at the moment.

@rafaeln
Copy link
Author

rafaeln commented Apr 28, 2014

What if you implemented a version check at the beginning of the script to decide whether to activate this functionality?

On Monday, April 28, 2014, Junegunn Choi notifications@github.com wrote:

This one is tricky. Actually Goyo command opens the current buffer in a
separate window in a new tab. Your modifications to the folds are then only
local to this new window. In order to apply the updated folds back to the
original window, Goyo has to save the information using mkview command.
However the command seems to have backward compatibility issue, in other
words, it works differently on older versions on Vim. So I'm not sure if I
want to implement this at the moment.

Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-41556959
.

@junegunn
Copy link
Owner

I've confirmed that :mkview works as expected on Vim 7.0 as well, I was mistaken. So, I was able to implement fold preservation using mkview and source (not loadview). However, I'm running into a number of nasty problems: enew triggered on unnamed or "nofile" buffers, syntax highlighting occasionally lost, mkview not working with close, etc. Currently I can't spend more time on this issue, but I'll try to keep you updated with the progress. And feel free to send me a pull request if you know a better way of doing it.

@rafaeln
Copy link
Author

rafaeln commented Apr 29, 2014

I read the documentation of mkview and I concluded it did too many things. It would be nice to have a pair of functions that only saved/restored the folding. But since they don't exist, I also don't think it's worth anyone's time to try and implement this feature. I guess I'll just close this bug.

@rafaeln rafaeln closed this as completed Apr 29, 2014
@junegunn
Copy link
Owner

I thought I was going to keep this issue open. But I guess you're right, obviously there's no clean way to accomplish it. Thanks.

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