My .vimrc:
" Filetype Detection
" {
"filetype on
"filetype plugin on
"filetype indent on
filetype plugin indent on "Turns all the above features on ;-)
" }
" Auto Completion (Ctrl-x Ctrl-o)
" {
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete
" }
Ctrl+X + Ctrl+O performs omni-completion the lookup. (:help completion for
details.)
Install excuberant ctags:
Package name: ctags
http://ctags.sourceforge.net
Also, checkout the excellent vim plugin(s) by Fritz:
cvim - c/c++ vim plugin
http://www.vim.org/scripts/script.php?script_id=213
A good book, instead of reading VIM's help file, is "Learning the vi and Vim
Editors 7th Edition". It'll explain the vimrc settings I posted above in
detail.
--
Roger
http://rogerx.freeshell.org/
It's certainly to install clang_complete [1]. It's not that omnicppcomplete is a bad plugin, it's just that it's rely on ctags and that ctags' C++ understanding is not very good.
NB: I still require ctags in my C/C++ ftplugin suite for various advanced operations (refactoring, functions overriding, etc). Until I take the time to migrate to clang or to gcc plugins.
HTH,
[1] https://github.com/Rip-Rip/clang_complete
--
Luc Hermitte
http://lh-vim.googlecode.com/
http://hermitte.free.fr/vim/