Hacker News new | past | comments | ask | show | jobs | submit login
EditorConfig (editorconfig.org)
241 points by Jonanin on Oct 16, 2014 | hide | past | favorite | 38 comments



The idea seems very cool, but I wonder if there is anything like this that could have more language specific stuff like "in JS (or Ruby, or ...) format your hashes/object literals/arrays/constants/... like so."

I like this, but the list of supported properties seems pretty short. I can see there might be some difficulties making it language-aware since the file formats are simple globs, but maybe you could say something like:

  [*.js]
  language_style = javascript
and somewhere describe that language_style in more detail.


.editorconfig supports domain specific properties: https://github.com/editorconfig/editorconfig/wiki/EditorConf.... Its encouraged that other extensions/tooling take a dependency on .editorconfig to introduce their own configuration.



Interesting. I'll take a look to see what domain specific properties exist.


Typically those are done using configuration files of code-checking tools, such as .jshintrc[1] or .pylintrc.

[1]: https://gist.github.com/connor/1597131


I guess I just figure these two are sort of overlapping. If you use .jshintrc why do you need this tool?

(The neat idea being: if a project has many languages, you can share code conventions for all of them in one place.)


The nice thing about EditorConfig is that it fixes some problems before they occur instead of requiring you to manually fix things after running a linter (e.g. spaces vs tabs)


What are you looking to do with "language styles" that you can't do based on file extension?



There is JSCS for Javascript: https://github.com/jscs-dev/node-jscs#options


EditorConfig is excellent. Straightforward to write a configuration file and pretty great editor support. I've only ever used the Vim plugin, but it works seamlessly such that I don't even notice.


Might it make more sense to rather compile the editorconfig file into the respective editor's config file? That way you need not depend on a plugin being written for the editor. This would mean that you could support more editors and enhance editor configurations without having to wait for the plugin to update to support your own new features. This would be at the cost of the ease of simply editing a single file, though it could be set up that, when compiled, the system will back the old config file up and insert the new one in its place.


EditorConfig support built-in to your text editor is the pipe dream. JetBrains 9 will have EditorConfig support, but no other editors yet support it natively so all of the plugins are necessary currently.

Unfortunately many editors do not support project-level configuration files by default. A conversion tool could be a good way to make global configurations even more accessible for editors that do support project configuration files and don't have native EditorConfig support yet.

Until native support becomes more common, EditorConfig acts as an unopinionated universal editor-level linter of sorts.


Then this would mean that you would have to compile this for every editor anyone editing the code base chose to use. It also means someone editing the code would have to manually copy the config file into the correct location. This kills the fact that EditorConfig plugins can automatically change settings per project, which is where a lot of the usefulness comes from IMO.


If your favorite editor does not yet have an EditorConfig plugin, feel free to tweet @EditorConfig or open an issue.

The Eclipse plugin has a small bounty on it right now. Maybe someone will create one if some more money is pitched in: https://freedomsponsors.org/issue/271/support-eclipse


The logo is so cute. Did you notice the mouse has blue eyes and pink ears ?


Hmm, I can see the pink ears, the blue eyes not so much. I may need to calibrate my monitor.


I've been using this for at least a couple of years and was expecting it to develop further (offer more common settings for editors) and to gain native support as, for example, the Sublime Text plugin loads the file using default tab size, then EditorConfig plugin kicks in and changes tab size to 4, let's say, which causes a full redraw and that always annoys me.


Native support is the ultimate goal. WebStorm 9 will have EditorConfig support built-in (as noted here: https://www.jetbrains.com/webstorm/nextversion/).


Great! Let's keep spreading awareness so that this becomes a high-demand item for each editors! I personally commit to make a PR to each major project I use as I found out about EditorConfig just by being curious about the config file in a project, so, this will definitely boost adoption.


I loved EditorConfig until tools like clang-format[1] and gofmt[2] showed up. Combine those with Git's hooks and you really got something.

[1]: http://clang.llvm.org/docs/ClangFormat.html

[2]: https://golang.org/cmd/gofmt/


Scalariform is pretty awesome too: https://github.com/mdr/scalariform


Combine with something like https://github.com/schorfES/grunt-lintspaces to check that all code complies + some tests before or after you push your code upstream to eg. Git and you'll get a much more consistent code base when it comes to whitespaces.


If your project doesn't use Grunt, but you do use Vim, you can put the following in your .vimrc

    " Remove trailing whitespace for everything but markdown.
    let whitespace_blacklist = ['markdown']
    autocmd BufWritePre * if index(whitespace_blacklist, &ft) < 0 | :%s/\s\+$//e
There's also several ways to use Git for removing trailing whitespace, if you prefer that.


I was surprised this only appeared here today.


I'd love to see an editor that let me see the code in the way I preferred (perhaps even as far as rendering Java as Lisp), but wrote the code to disk according to the EditorConfig.


From what I've seen, people sometimes accomplish this with git hooks. Well, not exactly what you want, but the basic: you see something different as is eventually saved to repository (and vice versa).


It's been a while since I found something immediately useful for me a this thing. Thank you so much.

I use Emacs but I hate with passion configuring it. Not anymore :)


Have used this in a handful of projects. Works as advertised. Easy to setup.


I wonder when Netbeans will support this


There is a community-contributed EditorConfig NetBeans plugin but it doesn't have a license or installation instructions: https://github.com/geertjanw/editorconfig-netbeans


Pleased to see RubyMine support!


If the IDE would just let me plug in whatever editor I like the most, that would be great.

I guess there could be conflicts with things like hotkeys, but some tweaking should get rid of such incompatibilities.


Why would you launch without Eclipse?


If you do go ahead and build support for it there is a small bounty already up for grabs.

https://freedomsponsors.org/issue/271/support-eclipse


Because large portions of the world does not care about Eclipse?


We "launched" a couple years ago with support for only a handful of editors. Most of the plugins have been community-made.

No one has submitted an Eclipse plugin yet, but we would love to help make one happen.


You could go ahead and build support yourself.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: