From Fedora Project Wiki

< PavelAlexeev

Revision as of 19:11, 20 December 2009 by Hubbitus (talk | contribs) (My tabsize initial)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

In most cases I use 5-space tab with to easy distinguish tabs and spaces mix.

Often many users ask me about it like [1][2][3]:

Why tabsize of 5? It just seems non-standard :) Don't suppose I could convince you to use 4 or 8 or to just use spaces? Do we really need that ugly looking thing above the %configure?

I'm tired to answer. It is because I make decision to write it.

  • There NO standard tab size! It was discussed not once: [1]
  • Fedora have not mention this in any guidelines, policy or recommendations. But many project have such policy and you are will surprised, with many different tab sizes. Citing Ralf Corsepius tabwith examples[2]:

  • Some BSDs systematically use a tab width of 4 everywhere.
  • Some vi users typically user a tab width of 3 (I am not using vi, so

no idea where this originates from).

  • Many users apply a tab width of 2.
  • There are editors, which seem to guess on "best tab expansions".

  • There was also attempt to propagate it into guidelines[3]. Off course with no success.
  • If you want spaces - no problem there, I wrote simple script for conversion: tabs-to-spaces-conversion.php.

Yo may use it like:

$ cat your.spec | ./tabs-to-spaces-conversion.php > your.spec.spaces

Or, with power of UNIX-WAY, off course directly in shell f.e:

$ cat your.spec | php -r 'define("TAB_WIDTH", 5);foreach(file("php://stdin")
as $l){preg_match_all("/\t+/", $l, $m, PREG_OFFSET_CAPTURE);foreach($m[0] as
$mm){$l = str_replace($mm[0],str_repeat(" ", (TAB_WIDTH - ($mm[1] % TAB_WIDTH))
+ (  TAB_WIDTH * ( strlen($mm[0]) - 1 )  )), $l);}echo $l;}' >
  • And last - it normal looking with 5 space tab with. If you use another settings and another preferences in your software - why I must use it similar? With my 5 spaces with your files seams broken indentation, but I do not complain to it!?