[lug] Vi and Bracket Indenting

Nick Golder nrg at nirgo.net
Tue Oct 11 18:39:51 MDT 2005


On 2005-10-11 17:48 -0600, Bill Thoen wrote:
> I'm trying to figure how to change vi's indenting behavior after typing a
> curly bracket when writing C code. It seems to indent code between { }
> brackets far too deeply. For example:
> int test()
> {
>           /* codes starts way out here */
> }
> 
> but what I want is an indent of one tab, set to about 2 or 4 spaces.
> 
> I tried a vin rc file and when I used it with vi -u vimrc I got no default
> indent behavior, so I thought, "ah ha! the key is in here!" So I
> progressively commented out each setting, and guess what? It was none of
> these. The default indent behavior is somewhere else. But where? And how do
> I modify it?
> 
> Anyone know?
> 

set ts=n

Where n is the desired space - and add to your .vimrc file if you want
this to be the default behaviour.

-- 
-Nick Golder



More information about the LUG mailing list