Bug 161177 - Automatic indentation doesn't work at all in vim
Automatic indentation doesn't work at all in vim
Product: Fedora
Classification: Fedora
Component: vim (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Karsten Hopp
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2005-06-21 00:15 EDT by Chris Gonnerman
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-06-21 05:40:10 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Chris Gonnerman 2005-06-21 00:15:47 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4

Description of problem:
No matter what I do, I can't get the automatic indentation to work in VIM.  I've tried with both Python and C source files, and when I start a new block it does not indent, nor does it "dedent" when I close a block in C.  Whatever indentation level it is at, it stays there for each new line until I change it.

I tried first with a stock install, then created a .vimrc containing the following:

set autoindent
set expandtab
set smarttab
set sw=4
set ts=4
set showmatch

Neither way works at all.  This works fine on my SuSE 6.3 system.

Version-Release number of selected component (if applicable):


How reproducible:

Steps to Reproduce:
Start VIM with a source file that should be indented, like test.c.  Type in a properly-formatted function definition (for example) and note that the automatic indent doesn't happen when you start the block (with the open-curly).

Actual Results:  It didn't indent.

Expected Results:  It should have indented one tab-stop (four spaces with the vimrc described above).

Additional info:
Comment 1 Chris Gonnerman 2005-06-21 00:25:48 EDT
Never mind.  I just discovered the difference between vim-enhanced and
vim-minimal, namely that typing "vi" isn't the same as typing "vim" at the prompt.

This REALLY ought to be in the FAQ, as I looked there first.
Comment 2 Karsten Hopp 2005-06-21 05:40:10 EDT
Closing as NOTABUG based on last comment.

BTW: You might want to use smartindent or cindent, whichever better matches
your programming style. From the vim manual:

There are in fact four methods available for indentation:
'autoindent'	uses the indent from the previous line.
'smartindent'	is like 'autoindent' but also recognizes some C syntax to
		increase/reduce the indent where appropriate.
'cindent'	Works more cleverly than the other two and is configurable to
		different indenting styles.
'indentexpr'	The most flexible of all: Evaluates an expression to compute
		the indent of a line.  When non-empty this method overrides
		the other ones.  See |indent-expression|.

Note You need to log in before you can comment on or make changes to this bug.