Will Senn <will.senn(a)gmail.com> wrote:
OK. So, I've been trying to decide (for the last
time, I swear) whether
to use tabs or spaces in my code...
Personally, I prefer:
* hard tabs, which display as 8 spaces
* 80 column wide text windows
* "if your code is marching off the right side of the screen,
your logic is probably too complex".
The beauty of hard tabs is that the person viewing the code can
choose how to display them in their editor. If everyone indents
with the Tab character, the problem goes away.
SVR4 vi, BSD nvi, and vim all support the tabstop option:
tabstop (ts) 8
Defines number of spaces that a [TAB] indents during editing session.
(Printer still uses system tab of 8.)
If you prefer 2 space indentation, in vi(1) do ":set ts=2".
If you prefer 4 space indentation, in vi(1) do ":set ts=4".
...
Set your preferred default in ~/.exrc, ~/.nexrc, ~/.vimrc ...
set ts=N
to do this automatically.
I'm sure other editors have a similar setting.
Using the Tab key also eliminates the issues in makefiles.
scot