If you use tabs for left-side indentation only, you can avoid all problems to do with variations in the display of tab widths.
Use spaces instead of tabs for alignment within a row of text, and never try to align stuff vertically from different tab stops; start all rows that need to be vertically aligned at the same tab stop, then spaces after that.
Examples of common mistakes:
Code: Select all
> = tab
. = space
> don't> do> this
> do......do..this
> dont(> int.do,
> > > int.this)
> do(.int.do,
> ....int.this)
If you make a rigorous habit of it, I find that variable tab stop sizes become a non-issue, and you can retain the advantages of tabs for indent this way. I don't like using spaces instead of tabs just because it means I have to deal with typing and deleting multiple spaces frequently. The editor can usually automate a lot of it, but if not using actual tabs there's always tons of cases where I still have to deal with all those spaces hanging around.
Of course, in a professional setting, or when working with someone else's code, I don't have a choice, I must adopt the prevailing style. If your editor lets you show whitespace characters, I find this is a big help for quickly identifying the style used. (Especially helpful if you can make the whitespace characters a pale colour against the white background.) Also, try to get an editor configurable for tabs vs spaces and different tab stop sizes, if you can.