Minimal .vimrc for C/C++ developers
VIM is a very powerful editor, and a standard developing tool for Linux users. Meanwhile VIM is also available for Windows. The good thing is, it is very customizable and can do almost everything. The bad thing is, by default most features are turned of, because it depends on your use case of the editor, what features should be turned on or off.
I’m a C/C++ developer, so I configured it for developing. Just store this file in your home directory or add it to your existig .vimrc. VIM will read this file at startup and configure it for C/C++ developing.
What this configuration offers:
- Visual: Syntax-highlighting and line numbers
- Editor Configuration: tab expanding to space, tabwidth 4, linewrap at 120 characters, C indentation, simple save file using [F2] (works in insert mode and normal mode)
- Navigation: Goto-Definition with [F12]. The word under the cursor is looked up using the ctags index file.
- Autocompletion: Therefore omnicppcomplete has to be installed additionally. See comments in .vimrc.
- [F5] automatically generates the tags file for the current folder.
- Intelligent Comments: Just type /* Text. The next * will be inserted automatically. / closes the comment automatically.
- Doxygen Comments: Creating doxygen comments for function under cursor using [F6]. Therefor DoxygenToolkit needs to be installed. See comments in .vimrc.
- Spell Checking using vim-spell: Use Alt-Down/up to jump from own spelling error to the next/previous. Use zg to add a good word, z= to get suggestion.
Another thing that works out of the box: Press SHIFT-K to lookup the function under cursor in the manpage – that’s the integrated help

Vim with OmniCppComplete
1 " VIM Configuration File
2 " Description: Optimized for C/C++ development, but useful also for other things.
3 " Author: Gerhard Gappmeier
4 "
5
6 " set UTF-8 encoding
7 set enc=utf-8
8 set fenc=utf-8
9 set termencoding=utf-8
10 " disable vi compatibility (emulation of old bugs)
11 set nocompatible
12 " use indentation of previous line
13 set autoindent
14 " use intelligent indentation for C
15 set smartindent
16 " configure tabwidth and insert spaces instead of tabs
17 set tabstop=4 " tab width is 4 spaces
18 set shiftwidth=4 " indent also with 4 spaces
19 set expandtab " expand tabs to spaces
20 " wrap lines at 120 chars. 80 is somewaht antiquated with nowadays displays.
21 set textwidth=120
22 " turn syntax highlighting on
23 set t_Co=256
24 syntax on
25 colorscheme wombat256
26 " turn line numbers on
27 set number
28 " highlight matching braces
29 set showmatch
30 " intelligent comments
31 set comments=sl:/*,mb:\ *,elx:\ */
32
33 " Install OmniCppComplete like described on http://vim.wikia.com/wiki/C++_code_completion
34 " This offers intelligent C++ completion when typing ‘.’ ‘->’ or <C-o>
35 " Load standard tag files
36 set tags+=~/.vim/tags/cpp
37 set tags+=~/.vim/tags/gl
38 set tags+=~/.vim/tags/sdl
39 set tags+=~/.vim/tags/qt4
40
41 " Install DoxygenToolkit from http://www.vim.org/scripts/script.php?script_id=987
42 let g:DoxygenToolkit_authorName="Gerhard Gappmeier <gerhard.gappmeier@ascolab.com>"
43
44 " Enhanced keyboard mappings
45 "
46 " in normal mode F2 will save the file
47 nmap <F2> :w<CR>
48 " in insert mode F2 will exit insert, save, enters insert again
49 imap <F2> <ESC>:w<CR>i
50 " switch between header/source with F4
51 map <F4> :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR>
52 " recreate tags file with F5
53 map <F5> :!ctags -R –c++-kinds=+p –fields=+iaS –extra=+q .<CR>
54 " create doxygen comment
55 map <F6> :Dox<CR>
56 " build using makeprg with <F7>
57 map <F7> :make<CR>
58 " build using makeprg with <S-F7>
59 map <S-F7> :make clean all<CR>
60 " goto definition with F12
61 map <F12> <C-]>
62 " in diff mode we use the spell check keys for merging
63 if &diff
64 " diff settings
65 map <M-Down> ]c
66 map <M-Up> [c
67 map <M-Left> do
68 map <M-Right> dp
69 map <F9> :new<CR>:read !svn diff<CR>:set syntax=diff buftype=nofile<CR>gg
70 else
71 " spell settings
72 :setlocal spell spelllang=en
73 " set the spellfile - folders must exist
74 set spellfile=~/.vim/spellfile.add
75 map <M-Down> ]s
76 map <M-Up> [s
77 endif
78

You should consider include the files itself for download, cutting every number is a pain!