Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Indentation style
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Tab vs. space === Typically, a programmer uses a text editor that provides tab stops at fixed intervals (a number of spaces), to assist in maintaining whitespace according to a style. The interval is called the ''tab width''. Sometimes the programmer stores the code with tab characters {{endash}} one for each tab key press or they store a sequence of spaces equal in number to the tab width. Storing [[tab character]]s in code can cause visual misalignment when viewed in different contexts, which counters the value of the indentation style. Programmers lack consensus on storing tab characters. Proponents of storing tab characters cite ease of typing and smaller text files since a single tab character serves the purpose of multiple spaces. Opponents, such as [[Jamie Zawinski]], state that using spaces instead increases [[cross-platform]] [[Porting|portability]]. <ref>{{cite web |url=http://www.jwz.org/doc/tabs-vs-spaces.html |title=Tabs versus Spaces: An Eternal Holy War |first=Jamie |last=Zawinski |year=2000 |access-date=6 June 2016}}</ref> Others, such as the writers of the [[WordPress]] coding standards, state the opposite: that hard tabs increase portability.<ref>{{cite web |url=http://codex.wordpress.org/WordPress_Coding_Standards#Indentation |title=WordPress Coding Standards |access-date=6 June 2016}}</ref> A survey of the top 400,000 repositories on [[GitHub]] found that spaces are more common.<ref>{{cite web|url=https://medium.com/@hoffa/400-000-github-repositories-1-billion-files-14-terabytes-of-code-spaces-or-tabs-7cfe0b5dd7fd|title=400,000 GitHub repositories, 1 billion files, 14 terabytes of code: Spaces or Tabs?|last=Hoffa|first=Felipe|date=2017-07-26|website=Medium|language=en|access-date=2019-07-09}}</ref> Many text editors, including [[Notepad++]], [[TextEdit]], [[Emacs]], [[vi (text editor)|vi]], and [[GNU nano|nano]], can be configured to either store tab characters when entered via the tab key or to convert them to spaces (based on the configured tab width) so that tab characters are not added to the file when the tab key is pressed. Some editors can convert tab to space characters and vice versa. Some [[Terminal pager|text file pagers]], such as [[Less (Unix)|less]], can be configured for a tab width. Some tools such as [[Expand (Unix)|expand]]/[[unexpand]] can convert on the fly via filters.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)