editorconfig / editorconfig

EditorConfig universal issue tracker and wiki
http://editorconfig.org
3.21k stars 103 forks source link

Allow specification of default settings #227

Open treyhunner opened 9 years ago

treyhunner commented 9 years ago

Goal

Allow user to declare user-specific settings that should be used in every editor they work in

Possible implementation

EditorConfig looks for a .editorconfig-defaults file which is used as a fall-back for unspecified settings.

For example, in most projects when indent_style = tab is specified, indent_size and tab_width are usually left blank so that the user can use their preferred style. Instead of configuring every editor to use a preferred style, the user could specify indent_size = 4 to use this as the default.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

jednano commented 9 years ago

User settings traditionally override project-wide settings (e.g. Sublime Text user settings override the defaults). To me, the .editorconfig file has the default settings and perhaps an .editorconfig.user file would have user-specific settings that override those defaults?

This way, the user also has the power to override stupid project-wide settings that shouldn't have been introduced in the first place, like tab_width. What happens if I'm forced to work on a project where they already specified tab_width and now I have no way to override it? That's the scenario I'm trying to prevent.

xuhdev commented 9 years ago

@jedmao IMO it would lose the purpose of editorconfig. tab_width shouldn't be set if the project does not use a mixed tab-space strategy, e.g. gcc, vim. If this is the only case you care about, it may be better to correct the project .editorconfig rather than "break" the project rules. We can put more tab_width explanation on the homepage to prevent future misuse.

Please note that your proposal is different from the original proposal.

jgkamat commented 9 years ago

I would be in support of this (in some form). I personally hate seeing tabs with size 8 indentation, and all my projects on github show up with size 8 tabs. If we could specify the default tab size to 4 somehow in project editorconfigs, people could view the project on github with a tab size of 4.

On a computer, however, people really should specify tab_width/indent_size and projects with tabs shouldn't set it (other than specifying a default, if something like this gets accepted).

Perhaps we could have a default_size variable, that gets used as indent_size/tab_width if they are both not set.

xuhdev commented 9 years ago

If I understand correctly, currently the default settings can be simulated by adding an extra .editorconfig file in the parent dir plus move root=true to parent, is it correct?

treyhunner commented 9 years ago

@xuhdev that sounds right

ctjhoa commented 9 years ago

yeah but the @xuhdev implies to move root=true and if the project if tracked by git (for example) you get the .editorconfig has modified and you never want to commit this thing. It's pretty messy with VCS. @jedmao seems much more reasonable too me. You will ignore all .editorconfig.user files

xuhdev commented 9 years ago

@ctjhoa I was saying the equivalent effect, not do it in practice.