Hacker News new | past | comments | ask | show | jobs | submit login

This should help. Stick and en editorconfig file in the root of your project and tell it to use tabs and if all developers are using a supported editor then their (superior) spaces would be converted to the (inferior) tabs lol

on the other hand, i appreciate being able to comment out lines by typing `//` and not having my indentation f'd up. i also like to be able to un-indent stuff using backspace rather than shift-tab. also, using tabs at 4-spaces allows me to more easily detect misalignment since deleting one 4-space tab is obvious, while deleting a single space is not. while i know EOL line comments are not everyone's cup of tea, good luck getting good alignment (or changing alignment) on those with spaces.

i say tabs are superior. the real solution is probably variable width tabstops: http://nickgravgaard.com/elastic-tabstops/

> also, using tabs at 4-spaces allows me to more easily detect misalignment since

If you use an autoformatter there is no need to manually check for misalignement!

Just type in some code, press a key and everything is aligned, problem solved!

Yes. With this sort of tool, all this potential drudge work simply vanishes! I suppose if you don't use these tools, it might not be obvious just how amazingly super convenient it all becomes.

Indentation all fucked up? No problem, press the auto format key, and the computer will unfuck it for you.

Need to indent or unindent a block of code? No problem, press the auto format key. You don't even have to think about whether it needs more indentation, or less. The computer will do that for you.

Do you type all your code on one line without putting any spaces in? Well, don't tell anybody, just press the auto format key, and they will never find out. (I know I just told you not to tell anybody, but: I do this all the time. And it's great.)

In fact, you don't need to really think about any of this whatsoever even at this level of detail, because you can just develop the habit of pressing the reformat key every now and again. Or get the editor to do it every time you save, and then you don't even have to remember to do that.

But, however you do it, this sort of tool reduces to pretty much zero the amount of energy you have to expend on caring about how the code looks.

My experience with spaces is usually editors treating 4 spaces as a tab when backspacing. The rare need for a real single unit backspace has to be made up for with 3 additional spaces.

The trouble is most editors do this half-assed, for example you can select half of a "tab" if you use spaces, which makes no sense and lets you screw up the indentation easier.

The only editor that really does properly support "just set this option and then it's like you are using tabs" is Atom. But I don't really want to use Atom.

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