This is a collection of snippets that should help configuring Vim for Libav development.
Make sure that you are the owner of ~/.vimrc or vim will not load your configuration.
Remember that if you use gVim or MacVim the configuration file is different. Graphical User Interfaces for vim read options from ~/.gvimrc instead of ~/.vimrc. Most of the times you do not want/need a separate configuration file, so a quick way is to have a simple simlink from one to another;
ln -s ~/.vimrc ~/.gvimrc
4 spaces, no tabs, except on Makefiles
" 4 spaces, no tabs. set expandtab set shiftwidth=4 set softtabstop=4 set cindent set cinoptions=(0 " Allow tabs in Makefiles. autocmd FileType make,automake set noexpandtab shiftwidth=8 softtabstop=8 " Trailing whitespace and tabs are forbidden, so highlight them. highlight ForbiddenWhitespace ctermbg=red guibg=red match ForbiddenWhitespace /\s\+$\|\t/ " Do not highlight spaces at the end of line while typing on that line. autocmd InsertEnter * match ForbiddenWhitespace /\t\|\s\+\%#\@<!$/
Forcing this line will colour git commit/rebase edits too if your editor is vim.
Restore file position
This snippet will reopen the file at the same line when it was closed last time, instead of at the beginning.
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") \| exe "normal! g'\"" | endif
Swap file in another directory
In order to avoid polluting the source tree with editor-specific temporary files, it is better to store Vim swap files in a separate folder.
" store swap in separate directory set directory=~/.vim//,.