Sunday, January 6, 2008

vim C / C++ auto completion

Scripts (extract zip in ~/.vim)

Needs ctags:
sudo apt-get install exuberant-ctags

Use Ctrl-x Ctrl-o for C++ omni-completion.

My omnicppcomplete settings can be found here.

You need to add your tags file if it's not in the current working directory:
:set tags+=/path/to/my/tags


kholis said...

ctrl-x ctrl-o is not work for me.
but ctrl-n and ctrl-p works.
is there something wrong with mine?

leo said...

Did you install the OmniCppComplete scripts that are linked at the top of the post?

With it comes also a helpful manual that describes the changes needed in your vimrc file to load the plug-in.

And don't forget that you need to be in insert mode for Ctrl-x Ctrl-o to work.