How do I make vi–Vim never use tabs (converting spaces to tabs, bad!), makes the tab key == 4 spaces, and automatically indent code after curly brace blocks like Emacs does?
Also, how do I save these settings so I never have to input them again?
I've seen other questions related to this, but it always seems to be a little off from what I want.
Best Answer
As has been pointed out in a couple of other answers, the preferred method now is NOT to use smartindent, but instead use the following (in your
.vimrc
):In your [.vimrc:][1] file:The help files take a bit of time to get used to, but the more you read, the better Vim gets:
Even better, you can embed these settings in your source for portability:
To see your current settings:
As graywh points out in the comments, smartindent has been replaced by cindent which "Works more cleverly", although still mainly for languages with C-like syntax: