Get OmniCppComplete
Then install it: (It may overwrite some stuff... take care!)
Then create and set your common tags file: (correct for your local installation locations)
Add mapping to create/update local (CWD) project tags files:
Set up some default options:
Then add any convenience macros:
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*$'
if "backward" == a:direction
return "\<bs>"
else
return "\<tab>"
endif
endif
if exists('&omnifunc') && &omnifunc == 'omni#cpp#complete#Main' && prec =~ '[\.>]\s*[~]\?[a-zA-Z_]*[(]\?$'
" Class completion... use normal direction
" Use this with omniCompletion
if "backward" == a:direction
return "\<c-p>"
else
return "\<c-n>"
endif
endif
" else use generic completion: last-seen / reverse-order
if "backward" == a:direction
return "\<c-n>"
else
return "\<c-p>"
endif
endfunction
inoremap <tab><c-r>=CompleteTab("forward")<cr>
inoremap <s-tab><c-r>=CompleteTab("backward")<cr>
-------
Comments