Friday, October 8, 2010

Vim Autocomplete for Linux

First of all download the following file: omnicppcomplete-0.41.zip

1) Create a directory in your home directory called .vim

cd ~
mkdir .vim


2) Copy the downloaded file inside the .vim directory and unzip it

cd .vim
unzip omnicppcomplete-0.41.zip

Now inside our .vim directory we should have the following directories:

after
autoload
doc

4) Inside the .vim directory create a new directory called tags

mkdir tags

5) Enter inside our tags directory and run the following command:

cd tags
ctags -R --sort=yes --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ -f gl /usr/include/GL/
 
this will create a tag file named "gl" of the directory /user/include/GL/
Repeat this step for any include directory you want by changing the name of the tag file and the path
of the directory.
 
6) Edit our .vimrc file as follows:
set tags+=~/.vim/tags/gl
 
7) If you want to build tags of your own project (by pressing Ctrl-F12) add as follows to our .vimrc:
map  :!ctags -R --sort=yes --c++-kinds=+p --fields=+iaS --extra=+q .
 
That's it! 




0 comments:

Post a Comment