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

Option for opening folds if the last edited area is inside a closed fold #11

Closed
oblitum opened this issue Sep 2, 2016 · 6 comments
Closed

Comments

@oblitum
Copy link

oblitum commented Sep 2, 2016

I'd like to feature request an option for this feature of automatically opening folds, personally I don't like it because sometimes when opening a file one wants to check another position in the file and not care about the last one or the last fold, which sometimes one even wishes to keep closed because of that.

@farmergreg
Copy link
Owner

farmergreg commented Sep 2, 2016

If i add a new setting, would it fix your problem? Pseudo code below:

  • Add a variable called g:lastplace_open_folds
    • default: let g:lastplace_open_folds = 1
  • when g:lastplace_open_folds == 0, jump to the last edit position. do not open folds.
  • when g:lastplace_open_folds !=0, jump to the last edit position. open folds.

@oblitum
Copy link
Author

oblitum commented Sep 4, 2016

Yes sure, sorry the late response. I think the current behaviour is not expected/wished for everyone. To tell the truth, I inferred it was vim-lastplace that was doing it without bisecting my plugins, I was about to ask why vim was doing that on vi.stackexchange.com. Maybe possibly, let folds closed, as it's vim default behaviour, should be the plugin's default behaviour too? With the user having to be explicit about wanting that.

Regardless of default behaviour, an option would would be fine.

@farmergreg
Copy link
Owner

@somini do you have any opinions on this?

I just pushed a change set that implements the pseudo code described above. It would be great if our "folds" people @oblitum and @somini tried it out :) Please post here after you've tried it so I know it's working.

Thanks!

@oblitum
Copy link
Author

oblitum commented Sep 6, 2016

@dietsche thanks! This is good for me, already using it.

@somini
Copy link
Collaborator

somini commented Sep 6, 2016

Thanks for summoning me! I'm ok with putting this behind a flag, but I think the default should be opening the folds, otherwise the plugin might not seem to do anything. IMHO, if you don't want vim to goto the last place when you open a file, you can disable the plugin.

I can try this code later today.

@farmergreg
Copy link
Owner

Thanks for the feedback! We'll leave the default as is (open the folds). I'll close this issue now. Feel free to re-open it if problems are found :)

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

3 participants