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

It may be an editor feature, but it's a UX anti-feature.

If you are in a system small enough that you only ever have to look at code in a code editor, then this anti-feature won't be a real problem.

If you work in a sufficiently complex environment that displays code across a variety of platforms, tabs will only make working with the code more difficult.




Not really. Most interfaces let you select the tab size or use some sensible default (e.g. 4). If you are using tabs properly it doesn't matter what display size they have.

One odd exception is GitHub which inexplicably uses size-8 tabs by default which is way too big. I can only assume that somebody there is a space zealot and wants to screw up the UX for enlightened tab users.


Take a look at a picture of a mechanical typewriter:

http://blog.gngcreative.com/wp-content/uploads/2015/02/mi0fg...

Those metal things you can see there, those are tabstops. They are called tabstops because when you press the tab key, the carriage mechanically stops at the tabstop.

Tabstops were placed every 8 characters. A tabstop is simply a way to "type" 8 spaces with one keypress.

Github is not the only page that uses 8 spaces for a tab, and it's definitely not inexplicable. The Unix/Linux terminal uses 8 spaces by default if you insert a tab. Vim uses 8 spaces by default if you insert a tab. Python considers a tab to be equivalent to 8 spaces. I'm sure there are a lot of other systems that default to this value.

If you want to control how an indentation looks, use spaces. If you want tabs because the size is configurable and can be adjusted to one's preferences, you can't at the same time complain about "unreasonable configurations" that others use :)


> Tabstops were placed every 8 characters. A tabstop is simply a way to "type" 8 spaces with one keypress.

tabstops were _not_ restricted to 8 characters. In many systems different tabstops were different widths from their predecessor. E.g. your first tabstop might be 20 characters in but all the ones after it would be 8 past their predecessor. Alternately you could vary all of them but that'd look pretty weird.


Thanks, TIL. But 8 was common, right? At least from online sources I was under the impression that typewriter tabstops were the reason for the 8 character default.


Ok but I don't know if you noticed but we don't use typewriters anymore.


I was only answering to the assertion that tab-width of 8 is "inexplicable".


Yes really.

When I have to work on N platforms that are constantly shifting, I don't want to spend the overhead and mental effort to reconfigure the ones that can be reconfigured, and eat nameless dread on the ones that can't.

When you view code across dozens of platforms, across dozens of machines, your perspective on "high maintenance config" everywhere changes a bit.

If you can't be effective with default configs, you lose efficiency to config maintenance.

Really, the last thing I want to deal with while I'm triaging some critical issue is dependency management for N code viewers.


The `.editorconfig` file in question actually also instructs GitHub to display source code in your repository with a given amount of spaces-per-tab. Just place the file in the root of your repository:

  root = true
  [*]
  indent_style = tab
  indent_size = 2
That being said, GitHub's default setting can only be seen as a spaces mongering ploy to subvert the true usage of tabs.


8 is the standard tab width. That's probably why GitHub chose it. (Why 8? I've no idea. Somebody will be along with an explanation soon enough, I am sure, and you can decide whether you believe it or not. But, whatever, it has been 8 for a very long time.)


To change it from 8, you need the `tab-size` CSS property. This has long been supported by all except IE/Edge.

This can be very neat for responsive design: use tabs for your indentation, and then on large screens use `tab-size: 4` because you’ve got space to spare and four is generally superior to two, and on narrow screens use `tab-size: 2` because you don’t have as much width to play with.


I don’t think it’s GitHub that chose this; the standard size for a tab in most browsers seems to be eight characters.


That's a good point. I checked and it does actually just seem to pass the tab characters through, letting the browser do its thing.


If you're using a typewriter and constructing tables (hence "tab"), 8 is a good balance between column width and number of columns.




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

Search: