Skip to main content

Posts

Showing posts from July, 2008

Using OmniCppComplete and vim for C++ auto-completion

Get OmniCppComplete

Then install it: (It may overwrite some stuff... take care!)

ckdir ~/.vim/
cd ~/.vim/
unzip cppcomplete.zip


Then create and set your common tags file: (correct for your local installation locations)

~> ctags –R --c++-kinds=+p --fields=+iaS --extra=+q \
-f ~/vim/commontags \
~/dev/myTools/include \
/usr/include \
/use/lib/boost/include /usr/lib/qt3/include

------- .vimrc:
set tags+=~/vim/commontags
-------






Add mapping to create/update local (CWD) project tags files:

------- .vimrc:
map :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .
set tags+=./tags
-------






Set up some default options:

------- .vimrc:
" OmniCompletionOptions
set completeopt=menu,menuone
let OmniCpp_NamespaceSearch=2
let OmniCpp_ShowPrototypeInAbbr=1
" let OmniCpp_MayCompleteScope=1
-------






Then add any convenience macros:

------- .vimrc:
" Smart VS-type <tab-completion>
function! CompleteTab(direction)
let prec =strpart( getline('.'), 0, col('.')-1)
if prec =~'^\s*$&…