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

Custom location for .editorconfig #172

Open
nkakouros opened this issue May 25, 2021 · 6 comments
Open

Custom location for .editorconfig #172

nkakouros opened this issue May 25, 2021 · 6 comments
Labels

Comments

@nkakouros
Copy link

Is there a way to point to a random location for the .editorconfig file? In a project I work on, linter configuration files, editor configs, etc are present under resources/dev-helpers. It would be great to move the .editorconfig there as well.

@cxw42
Copy link
Member

cxw42 commented May 25, 2021

There is not an easy way, unfortunately. This has been discussed --- I'll post the link if I can dig it up.

Partly this is by design: .editorconfig files are meant to accompany the source they govern. Partly it is related to symlink handling, which is a real can of worms.

You could certainly modify the core included in this plug-in to look in whatever location you wanted. However, I don't think that's something we would add to the released version of the plug-in.

Does that answer your question?

@xuhdev
Copy link
Member

xuhdev commented May 25, 2021

For some editor plugins that are calling an editorconfig executable, you may be able to specify editorconfig -f your-editorconfig-file-name as the command.

Having said these, I agree with @cxw42 , this is by design. EditorConfig is meant for projects to help maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. If every project uses a different .editorconfig file location, then this purpose would no longer be served.

@xenoterracide
Copy link

seems related, I would like to have a "default editorconfig" for vim. For sourcecode it's easy to put one in the root, but it seems that for vim I use it to edit config files all over the place, so... point to this if no other is found would be great.

@cxw42
Copy link
Member

cxw42 commented Jul 17, 2021

Related discussion: editorconfig/editorconfig#236 .

I would personally accept a PR that added an opt-in "fallback .editorconfig" as a plugin option. That would not require any core changes, as far as I know. The semantics would be something like "if no .editorconfig files are found, use the settings in file g:EditorConfigFallbackSettings". @xuhdev would that be OK with you?

@xuhdev
Copy link
Member

xuhdev commented Jul 17, 2021

I think this feature is OK. I would suggest a bit attention to the primary goal of the project:

EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs.

As long as this goal is not jeopardized, I think it's OK (e.g., remind users in the doc).

Additionally, @xenoterracide is adding the configuration to your .vimrc directly OK? It doesn't sound like you would need .editorconfig.

@xenoterracide
Copy link

I thought about that but the problem is I wanted it sort of a fallback option if it doesn't otherwise find a normal .editorconfig . I'm sure there's a way to hack around it so that I could do that but I definitely don't know how to do it off the top of my head. Unless those already act as fallback options and finding an editorconfig would override them. That wasn't clear from the documentation how that interaction would actually work I kind of assume that the VIM config would take precedence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants