VIM Question [Archive] - C Board

PDA

View Full Version : VIM Question


Thantos
12-07-2003, 12:13 PM
Anyone know if you can change how much VIM indents when it does auto-indenting? I checked the vimrc file but all I found was the option to turn autoident on or off.
I want to change it from a tab to two spaces. Found the indent directory but not sure which file to change.

Thanks

Prelude
12-07-2003, 03:33 PM
It should be something along the lines of

:set autoindent tabstop 2

for a two space indention.

Thantos
12-07-2003, 07:10 PM
Thanks Prelude. Unfortunately that didn't do it. Looking through the help and stuff more I found that the setting I'm looking for is called sw. I can change it for that session by doing :set sw=2 but it doesn't change permeantly. I'll keep looking though.

Prelude
12-07-2003, 07:12 PM
>Unfortunately that didn't do it.
I would be able to help better if I were running Unix at the moment. My .rc file for vi sets the autoindent to 2. I'll grab it for you the next time I boot into Unix if you haven't solved your problem by then.

Jaguar
12-08-2003, 04:54 AM
>> I want to change it from a tab to two spaces.
I'm not sure I understand your question.
normally I use tab indenting.
if I want to change tab to spaces, I type ``:1,$s/\t/ /g'' before exporting to other editors.
if you mean autoindent with spaces, i don't know. :(
that's very bad for me and might cause me to change my avatar :p

>>:set sw=2 but it doesn't change permanently.
howabout put it in vimrc file?

Hammer
12-08-2003, 06:33 AM
Here's my .vimrc file (used for gvim as well)

:set guifont=*
:syntax on
:set tabstop=4
:set shiftwidth=4
:set smartindent
:set smarttab
:set expandtab

Jaguar
12-10-2003, 11:19 AM
I tested individual command.
seems that only :set expandtab is required.
Thx Hammer :)