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

Respect user's &autochdir for not triggered buffer #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JingMatrix
Copy link
Contributor

For buffers that won't trigger rooter, we can respect user's &autochdir
setting for them unchanged.

For buffers that won't trigger rooter, we can respect user's &autochdir
setting for them unchanged.
@airblade
Copy link
Owner

Can't you get the same behaviour by allowing rooter to run for all buffers and having let g:rooter_change_directory_for_non_project_files = 'current'?

@JingMatrix
Copy link
Contributor Author

No, I tried it.

And the reason for it is that, your code will for g:rooter_change_directory_for_non_project_files only applies to triggered buffers.

In fact, I thought, it is a design mistake in your code. Because your non_project_files actually means files considered by g:rooter_targets which are not in a project folder. But from common sense, file not considered by g:rooter_targets are usually non_project_files.

I say so, since as you can recall

function! s:rooter()
if !s:activate() | return | endif

your code skips non triggered files.

@airblade
Copy link
Owner

But why not trigger rooter in all buffers then?

@JingMatrix
Copy link
Contributor Author

Sorry, I was modifying my last comment since I realized I overlooked your first comment. I didn't see you mentioned enable for all buffers.

I thought, as your README suggests, user has choice for which buffer to be triggered.

Your suggestion sounds like a workaround. I think there is need to have control both over triggered buffers and project patterns. I suspect this is what users will expect.

@JingMatrix
Copy link
Contributor Author

Your perspective is also reasonable.

It is understandable for you to keep your opinion on how people think for project files.

@airblade
Copy link
Owner

I think it all depends on which way you look at it.

When I first wrote rooter it ran for every buffer and g:rooter_change_directory_for_non_project_files configured how to handle files which weren't under a "root".

Later on g:rooter_targets appeared in the code, mainly as a way to configure whether rooter should run on directories or just files. However I can see how one could almost use it to pre-define which files are under a root – and if you do that, you don't need g:rooter_change_directory_for_non_project_files.

Personally I find it easier to get rooter to run on every buffer (i.e. g:rooter_targets == '/,*') than to specify certain file extensions as targets. For me it doesn't work so well to say "these file extensions are always under a root" because sometimes they aren't, and sometimes other file extensions are.

@JingMatrix
Copy link
Contributor Author

Thanks for your historical explanation, now I get more of your idea.

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.

2 participants