Why is the default tab size 8 spaces? Where does this come from and why is it that big?
From the Wikipedia article on "Tab key":
In practice, settable tab stops were rather quickly replaced with fixed tab stops, de facto standardized at every multiple of 8 characters horizontally, and every 6 lines vertically (typically one inch vertically). A printing program could easily send the necessary spaces or line feeds to move to any position wanted on a form, and this was far more reliable than the modal and non-standard methods of setting tab stops. Tab characters simply became a form of data compression.
It is unclear why the 8-character horizontal tab size was chosen, since 5 characters, a half inch in a typical printer at that time, was much more popular as a paragraph indentation.
nelaaro
Linux admin, tech enthusiast. opensource evangelist.
Updated on September 18, 2022Comments
-
nelaaro over 1 year
When I push
tab
in many applications likevim
, OpenOffice etc., the tab size is equivalent to 8 spaces/characters.This is the default for many applications. When the default terminal size is 80 chars horizontally, why is the tab size this big? After 5 tabs I am half way across the terminal, and text starts to look ugly, with text wrapping.
I was wondering what the history behind the decision for 8 chars tabs is.
I know how to change the settings in vim to make it 4 chars. I just want to understand why we still have 8 set as the default across so many applications.
-
nelaaro over 12 yearsDid not think it has some thing to do with an inch at all.
-
nelaaro over 12 yearsWhy do we still keep that default.
-
Keith Thompson over 12 years@nelaar: Historical precedent; there are a lot of text files written to depend on 8-column tabstops. But I (and a lot of other people) prefer spaces rather than tabs for indentation. In my
.vimrc
, I haveset expandtab
andset sw=4
; I keep tapstops (ts
) set to the default 8. I use Ctl-T and Ctrl-D for indentation. -
Floris almost 7 yearsActually, I believe this comes from the days of manual typewriters - where a fixed tab stop every 8 characters allowed you to quickly format a table of numbers. 8 spaces allowed up to 7 characters plus a space; for most purposes that was (and is) sufficient. Any smaller and you can't fit your numbers; bigger, and you can't have very many columns in your table. I still have a manual typewriter that has fixed tab stops at every 8 characters.
-
GDP2 almost 7 yearsFyi, Wikipedia has modified that last paragraph to explain why 8 characters was chosen over 5 characters: "A common horizontal tab size of eight characters evolved, despite five characters being half an inch and the typical paragraph indentation of the time, because as a power of two it was easier to calculate in binary for the limited digital electronics available."