Elastic Tabstops

Elastic tabstops is not yet a common feature in text editors, so I want to add my 2 cents to explain benefits and bust some myths.

The original proposal by Nick Gravgaard can be found at http://nickgravgaard.com/elastictabstops/.

Myths

"Proportional font for programming is a nonsense"

Using proportional fonts in programming is not new, Smalltalk developpers have been using it for ages.

A 'w' is wider than 'i', so why should they have the same width ? Monospaced fonts are relics of typewriters and early computers.

Proportional font for programming is a nonsense only if you are programming in Befunge.

"Using elastic tabstops makes program unreadable with other text editors and viewers"

Advantages

Keep alignment

Lines in a "group" are automatically aligned when editing a line. It is no longer necessary to fixup alignment manually or using a macro.

When adding a new line, all previous lines are automatically aligned:

Solve alignment issues with proportional fonts

Alignment is impossible with spaces when using a proportional font and it does not work better with tabs as the alignment is broken as soon as you change the font.

Elastic tabstops make obsolete the developer's arguments "I can't use proportional font because I can't line up code".

Save memory and disk space

Tabs consumes less memory than expanded spaces: it saves disk space and makes compilations faster... ok, may be not so faster.

Limitations

The elastic tabstop feature is not the silver bullet to solve every situations.

Mixing indentation and alignment

It is not possible to mix indentation and alignment in the same group.

You have to insert an empty line to split groups or put comments above.

Elastic tabstops won't solve all alignment issues but it is really a powerful tool to easily align text and keep it aligned.

Examples of Use

This is just some examples for maniacs like me who like to line up everything.

Switch Statements

Switch/case statements are very table-oriented.

vs

Structures

In Comments

Data

Tabulated files

An unexpected benefit is the readability of tabulated files:

becomes