ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

To use OmniCppComplete with ROS, you have to generate a set of tags for the ROS stacks. There are probably better ways of doing this, but I was successful with find and grep.

First, generate a list of files that you want to generate tags from:

find /opt/ros/diamondback/stacks | grep -E '*/include/*/.*\.(h|hpp)' > /tmp/ros.filelist

Then use ctags to generate a tags database from this list:

ctags --sort=foldcase --c++-kinds=+p --fields=+iaS --extra=+q -f /tmp/ros.tags -L /tmp/ros.filelist

Once you have done this, you can move your tags file into your ~/.vim directory

mv /tmp/ros.filelist ~/.vim/tags/ros

And edit your ~/.vimrc file accordingly

set tags+=~/.vim/tags/ros
" OmniCppComplete settings to be tweaked
let OmniCpp_NamespaceSearch=1                                                                                         
let OmniCpp_GlobalScopeSearch=1
let OmniCpp_ShowAccess=1
let OmniCpp_MayCompleteDot=1
let OmniCpp_MayCompleteArrow=1
let OmniCpp_MayCompleteScope=1
let OmniCpp_DefaultNamespaces=["std","_GLIBCXX_STD"]
" Hotkey to generate tags for you current project
map <F5> :!/usr/bin/ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<cr>

Hope this helps.