866

By default Eclipse indents with a hard tab character. How do I change it to spaces?


  • @i3ensays because tabs are presented differently in different editors or environments whereas spaces are always consistent. - mmmdreg
  • @mmmdreg exactly my point. spaces are rigid and wasteful. Using tabs gives freedom to the viewer to configure their editor as desired. I like my tabs to display as 2 spaces, my colleague 4. This is not possible without use of tabs. My colleague here, and I, battle spaces when we each format in our respective editor; tabs are not an issue; this is why they were invented (I suspect). - i3ensays
  • @i3ensays amen, brother! I've been trying to make people understand this concept for over 10 years (rizzoweb.com/java/tabs-vs-spaces.html). What really alarms me is that, as programmers, you'd think everyone would understand the concept of abstractions (a tab is an abstraction of code indentation, while a fixed number of spaces is a hard-coded implementation) - but alas, it seems that many programmers can't see the abstraction here. - E-Riz
  • @i3ensays Your team should have a coding standard that clearly states how code is formatted. This would save time by preventing the battles you mention. You should adopt one asap but that standard will 100% certainly state that tabs are never to be used because this holy war was won by the "space people" ages ago so a standard won't help you. Aside from alignment issues one of the biggest reasons for spaces only is that revision control tools and code reviewers won't have to deal with this issue. I started on your side of this battle 20 years ago but eventually learned to embrace the space. - Night Owl
  • The reason is that people will inevitably end up with combinations of tabs and spaces and in some editors the code will not display correctly. If everyone just uses spaces then this is never a problem. - Eamonn McEvoy

Linked


Related

Latest