in reply to Re: The classical <TAB> issue
in thread The classical TAB issue
You could set it to output spaces instead of a literal \t, but I don't like having to do 8x or 4x to remove a level of indentation (in vi) when I can use simple x instead.Learn your vi. Assuming your cursor is on the code, and not on the indent, using the 'x' method to remove a tab takes you two key strokes: 0x, or ^X. But there's another way, that will work with spaces as well, doesn't require the cursor to be on the indentation, and which is sensitive to movement commands (so you can outdent regions): <<. And to indent: >>.
Sure, in this simple example it will. But suppose you have your tabstop set to 8, write the above code, check it in to source control, and someone with a tabstop set to 4 checks it out, and modifies it as follows:If I have tabstop set to 8 and someone else has it set to 4, it will look right in both cases.sub foo { <TAB>my ($bar, $baz) = @_; <TAB>if($bar) { <TAB><TAB>return $baz; <TAB>} <TAB>return 0; }
Looks great, with an 8 character margin on the right to spare, so it fits in the pleasing "72 character" width, and certainly it fits in the default 80 character window.sub foo { <TAB>my ($bar, $baz) = @_; <TAB>if($bar) { <TAB><TAB>if (fuzzle ()) { <TAB><TAB><TAB># Expression taking 60 characters. <TAB><TAB>} <TAB><TAB>return $baz; <TAB>} <TAB>return 0; }
The code is checked in, and you check it out again. You look at the code in your 80 character window, and the last four characters of the new code will appear wrapped to the next line. Yuck!
If even becomes much yuckier if the coding guideline says "4 character indent", and some people use an 8 character tab-stop, and some use a 4 character tab-stop. Say the current block has <TAB> as indentation and two if/else statements are added, by different programmers. One will use <TAB><TAB> as indentation - the other <TAB><SP><SP><SP><SP>. Fun! Fun! Fun!
Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: <blocThe classical <TAB> issue
by hardburn (Abbot) on Apr 06, 2004 at 15:50 UTC | |
by Abigail-II (Bishop) on Apr 06, 2004 at 18:36 UTC |