[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] Coding w/ vim



On Sun, Jun 03, 2001 at 11:06:09PM +0100, Colin Watson wrote:
| Matthias Richter <post-an@matthias-richter.de> wrote:
| >Cameron Matheson wrote on Sat Jun 02, 2001 at 03:45:30PM:
| >> 2. How do I set the tab-spacing?  I like to code w/ two-space tab-stops,
| >> but vim defaults to 8 :(
| >
| >set tabstop=2
| >set expandtabs
| >
| >this expands tabs (which is a good idea IMHO) and sets stop to 2.
| 
| For the sake of variety, I prefer something like:
| 
|   set softtabstop=2 shiftwidth=2 noexpandtab
| 
| ... and leave tabstop the way it is. This inserts tabs instead of eight
| spaces behind the scenes where appropriate, but tab and
| backspace-over-tab work as expected.

Just to add my $0.02 :

set sts=2 sw=2 ts=8 et

(You can guess from the abbriviations what options they are).

This always inserts spaces (the 'et') so it will be correct regardless
of what tool you use to view it.  It also keeps tabs following Th
Right Way (tm) -- 8 spaces.  By setting 'sts' and 'sw' you get the
appropriate indent, dedent, and backspace-over-tab behavior without
messing with the actual tabstop.

Not really asked for, but IMO a 2 space indent it too small.  I prefer
a 4-space indent, but do what you want with your own code :-).

-D



Reply to: