Trust in VIM: Omni-Completion...

This might sound a bit like latin lessons, but it is not ! Working with vim, once you have done your homework in learning it, is fun. But it is mighty as well. As from the 7.x release of VIM there is a build in function for c/cpp-omni-completion. By default it is empty and if you know VIM you can go ahead an built in your very own omni-completion. But that is just not what we want to do here...

So let's get started: What you will need for this is Exuberant ctags, which can be found under or under ubuntu you can just ask synaptic for it. (If you have installed vim-full it should include ctags already...). Since we just agreed on not writing our own omni-completion (well I did that for you) we will have to download this script from

Once you have the zip you extract it to your $HOME/.vim folder. After that you should run

:helptags $HOME/.vim/doc


:helptags $HOME/vimfiles/doc

that you can use :help omnicomplete with our new omni-completion. Congratulations ! You're done. bye-bye. cya...

Oh, wait. I might just add some more help. As the omni-completion is for c/cpp-files you should enable your filetype plugin with

filetype plugin on

in your .vimrc. You might also add

set cot-=preview

which will prevent an extra info window on STRG+X STRG+O. Generated tag-files from ctags can be added via

set tags+=path/to/my/taglist

To generate a tag-list you should try the ctags manual, but I think the <LANG>-kinds-option might be of interest. If you want to check out what kinds there are try

bash:~$ ctags --list-kinds

Enjoy your VIM...

Author: Frederic Siepmann, published: 2007-12-09 16:24:44