<p>How do I prevent vim from replacing spaces with tabs when autoindent is on?</p>

<p>An example: if I have two tabs and 7 spaces in the beginning of the line, and <code>tabstop=3</code>, and I press Enter, the next line has four tabs and 1 space in the beginning, but I don't want that...</p>

Maybe the bottom of this can help you?
Standard vi interprets the tab key literally, but there are popular vi-derived alternatives that are smarter, like vim. To get vim to interpret tab as an ``indent'' command instead of an insert-a-tab command, do this:
```
```
set softtabstop=2
```
```