[lug] Vi and Bracket Indenting

Brent Smith smitten at nextreality.net
Tue Oct 11 18:36:41 MDT 2005


this is a good resource:

http://vimdoc.sourceforge.net/htmldoc/options.html#'tabstop'

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 */
> }

You need to change the tab stop then.
:set ts=4 or :set ts=2

> 
> 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?

I would suggest checking the global vimrc file, but any changes made to
~/.vimrc should override settings in that file.

I would put your settings in the ~/.vimrc and then check that they are
applied when you fire up vim. If you don't know how to check the value
of a variable you can do it by putting a question mark after the
variable name

:set autoindent?

The only other place where I could imagine it changing settings is the
filetype plugins.

> 
> TIA,
> - Bill Thoen
> 
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug




More information about the LUG mailing list