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

Add autoclose_netrw configuration option #822

Merged
merged 1 commit into from
Aug 8, 2022

Conversation

raven42
Copy link
Collaborator

@raven42 raven42 commented Jul 14, 2022

Closes #821

This will add the autoclose_netrw configuration option. If set to 1
this will close out of vim if tagbar and netrw (or nerdtree) are the
only remaining windows. If set to 0, then this will leave the netrw (or
nerdtree) window if that is the only remaining window once tagbar is
closed.

Closes preservim#821

This will add the `autoclose_netrw` configuration option. If set to 1
this will close out of vim if tagbar and netrw (or nerdtree) are the
only remaining windows. If set to 0, then this will leave the netrw (or
nerdtree) window if that is the only remaining window once tagbar is
closed.
@raven42 raven42 requested a review from alerque July 14, 2022 13:55
@raven42
Copy link
Collaborator Author

raven42 commented Jul 15, 2022

@alerque I was wondering your opinion on a point in this PR.

If I'm understanding this correctly, in the current code, the s:HasOpenFileWindows() function would return a TRUE value if the netrw window was open. So in the event someone does not have nerdtree installed, and they follow the steps in issue #821, then I believe the netrw window would remain open.

Now if they do have nerdtree installed, as nerdtree provides an override for the netrw window, then if they follow the procedure in the issue, then as @WeissZucker pointed out, then the nerdtree window closes.

So onto this PR... one of the goals of this is to provide consistent behavior for both the netrw and nerdtree windows, but at the same time I don't want to disrupt the workflow of people that are used to the current behavior. With current behavior, they each behave differently. So now adding the configuration option does allow for customization, however I want to make sure we set the default value correctly. I'm making an assumption that most people that are using tagbar, probably are also using nerdtree, so I set the default for the g:tagbar_autoclose_netrw to TRUE, so people that do have nerdtree will have the same workflow. However people that have tagbar, but not nerdtree will see a change in behavior. Alternatively we could swap the default value, but then we'd have a change in behavior for people that do have both tagbar and nerdtree installed.... So I'm curious how best to handle this, and wanted to get your thoughts on it.

@alvan
Copy link

alvan commented Aug 8, 2022

Do you have any plans to merge this pull request? It solves a very serious bug I encountered, that is, when using bufexplorer, nerdtree, and tagbar at the same time, operations in bufexplorer (such as deleting a buffer) have unexpected errors.

@raven42
Copy link
Collaborator Author

raven42 commented Aug 8, 2022

@alvan yes I can merge it in. I was waiting for feedback from the community or other moderators as to the default value, however I can merge it in as is and then we can swap the default later if the default becomes an issue.

@raven42 raven42 merged commit 8e97021 into preservim:master Aug 8, 2022
@raven42 raven42 deleted the autoclose_netrw branch August 8, 2022 12:50
@Shane-XB-Qian
Copy link
Contributor

i wish this default value is to 0
as common sense, any default setting should not broken the consistent/previous behavior.
// wish we can keep it while in maintain sth, meant compatible.
at least, some user used netrw as 'project viewer', then had high possibility that's the last window!

@alvan
Copy link

alvan commented Aug 9, 2022

@raven42
Thank you so much for the update! After the update it worked very well in my use case.
And I also set: let g:tagbar_autoclose_netrw = 0 to minimize interference between plugins.

@raven42
Copy link
Collaborator Author

raven42 commented Aug 9, 2022

@Shane-XB-Qian / @alvan, I've changed the default to 0 based on your feedback. It seems more people are in favor of having this disabled by default, so we'll go with that.

Thanks for the feedback.

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

Successfully merging this pull request may close these issues.

Close pane with tagbar would also close the nerdtree pane
4 participants