A lot of vim's features (like autoindent
and cindent
) are turned off by default. To really see what vim can do for you, you need a decent ~/.vimrc
.
A good starter one is in $VIMRUNTIME/vimrc_example.vim
. If you want to try it out, use
:source $VIMRUNTIME/vimrc_example.vim
when in vim.
I'd actually suggest just copying the contents to your ~/.vimrc
as it's well commented, and a good place to start learning how to use vim. You can do this by
:e $VIMRUNTIME/vimrc_example.vim
:w! ~/.vimrc
This will overwrite your current ~/.vimrc
, but if all you have in there is the indent settings Davr suggested, I wouldn't sweat it, as the example vimrc will take care of that for you as well. For a complete walkthrough of the example, and what it does for you, see :help vimrc-intro
.