
EditorConfig - chei0aiV
http://editorconfig.org/
======
Already__Taken
> For Windows Users: To create an .editorconfig file within Windows Explorer,
> you need to create a file named .editorconfig., which Windows Explorer will
> automatically rename to .editorconfig

What a neat trick I had no idea. Been renaming those files on the cli all this
time.

On a related note: Why has it gone the way that _I_ must look at code _your_
way. Is there no chance of decoupling the presentation with logic like the web
has long preached us (not saying that worked). Tabs to spaces shouldn't be
some messy commit regardless of your preference on the matter.

Anyway, nice project. I understand your search preferences up from the project
root not down from my preferences because it's controlling other people's
coding standards.

~~~
bsimpson
I've often wondered this. I find columnar alignment of key:value pairs (in
CSS, dictionaries, etc) to be much easier to read, but I find that I'm an
outlier because most people get upset when they see whitespace changes in a
diff. (FWIW, `?w=0` will hide whitespace changes on GitHub).

It would be rad if an editor like Sublime or Atom understood columns and
displayed code that way without needing to reindent everything in the file
every time you add a longer key.

~~~
Macha
I find it more readable up until the difference in key lengths becomes larger
(font and text-decoration for example), at which point I have trouble matching
the values with the shorter names.

~~~
oneeyedpigeon
Just right-align your property names. I know that sounds ridiculous, but give
it a go:

    
    
      body {
                 font-size:  16px;
             margin-bottom: 100px;
               padding-top:  40px;
                     color: rgb(100, 100, 100);
          background-color: rgb( 90, 255,   3);
      }

~~~
Already__Taken
Oh way better yes. I sometimes like to indent dependent properties too:

    
    
      body {
        width: 400px;
        margin: 20px;
        position: absolute;
            bottom: 0;
            right: 0;
        background: #ccc;
      }

------
captn3m0
For those who don't know, github recently started supporting editorconfig[0]
files in repos, which means that if your repo has an editorconfig, it will be
respected by github in the online code viewer. Without an editorconfig file,
the default indentation on github is 8 spaces, because that's how pre tags
work. See the link for more info.

[0]:
[https://github.com/isaacs/github/issues/170#issuecomment-137...](https://github.com/isaacs/github/issues/170#issuecomment-137993149)

------
codebeaker
For more see the numerous older discussions of this
[https://news.ycombinator.com/from?site=editorconfig.org](https://news.ycombinator.com/from?site=editorconfig.org)

~~~
usea
HN has a direct link to this feature now. There's a link under the story
labeled "past." Although it goes to the official search instead of your link.
Cheers.

------
nzoschke
Nice. I'm addicted to automatically running `gofmt` on .go file saves.

Now I'm crazy sensitive to whitespace and formatting discrepancies that show
up in .js or .css files from different environments. It seems like
EditorConfig has a shot at improving this, particularly since GitHub supports
it.

Next step, strict linters/formatters for all languages.

Edit: Based on other comments pointing to the Javascript standard style
project, I found this to auto format .js files in Sublime Text:

[https://packagecontrol.io/packages/StandardFormat](https://packagecontrol.io/packages/StandardFormat)

------
drumdance
The IDE has now become an abstraction. Love it.

------
metalliqaz
Wasn't there an old standard for text format strings that could be placed at
the end of source files that would be understood by Vim and Emacs? I never
used it, but this reminds me of it.

~~~
dschep
Vim has modeline[0]. Is that what you meant?

[0]
[http://vimdoc.sourceforge.net/htmldoc/options.html#%27modeli...](http://vimdoc.sourceforge.net/htmldoc/options.html#%27modeline%27)

~~~
telotortium
And the Emacs equivalent, file-local variables[0]. However, these are editor-
specific, as far as I'm aware, although Python was able to extract the
commonalities between them to support file encoding in PEP 0263[1].

[0]
[http://www.gnu.org/software/emacs/manual/html_node/emacs/Spe...](http://www.gnu.org/software/emacs/manual/html_node/emacs/Specifying-
File-Variables.html#Specifying-File-Variables)

[1]
[https://www.python.org/dev/peps/pep-0263/](https://www.python.org/dev/peps/pep-0263/)

------
guidopallemans
Could this be extended to keyboard shortcuts? I always feel like the effort I
have to do setting the shortcuts on a new IDE is redundant, and shared with a
lot of people

~~~
eyko
Um... No thank you?

pd: the last thing I want as a developer is a developer on Windows overriding
my OSX keyboard shortcuts (or viceversa).

------
cheezburgler
yes, because coding style can be reduced to charset and indentation choice

~~~
beaker52
No, but ignoring these basic project conventions can lead to issues when
another developer tries to work with the file, specifically around charset and
line endings.

~~~
beaker52
editorconfig only defines the following properties:

    
    
      charset
      indent_style
      indent_size
      tab_width
      end_of_line
      trim_trailing_whitespace
      insert_final_newline
    

These are all sensible things to enforce (with the exception of tab_width,
which is actually a display preference). Subjectively, other things are mostly
flexible.

~~~
Maken
There are more properties listed in the complete list (link is above the short
list), mostly about parenthesis and braces. I guess they aren't listed in the
main page because they are language-specific.

