Turn on syntax highlighting:
:syntax on
For all files, set the format options, turn of C indentation, and finally set the comments option to the default.
:autocmd FileType * set formatoptions=tcql \nocindent comments&
For all C and C++ files, set the formatoptions, turn on C indentation, and set the comments option.
:autocmd FileType c,cpp set formatoptions=croql \cindent comments=sr:/*,mb:*,ex:*/,://
Turn on automatic indentation.
:set autoindent
Automatically write files as needed.
:set autowrite
Define some nice abbreviations:
:ab #d #define :ab #i #include
Define some abbreviations to draw comments.
:ab #b /******************************************************** :ab #e \^V^H*******************************************************/ :ab #l /*------------------------------------------------------*/
Set the size of an indentation.
:set sw=4
Have vim highlight the target of a search.
:set hlsearch
Do incremental searches.
:set incsearch
Set the width of text to 70 characters.
:set textwidth=70