Reputation: 23501
I just installed omnicomplete plugin, does it support header auto completion?
When I typed #include <
, is it possible to provide a list of header files to complete?
Many thanks!
Upvotes: 4
Views: 3126
Reputation: 206526
You can just use the vim autocomplete feature, which was introduced in vim7.
Just type in first few characters and press Ctrl->P(for backward search)
or Ctrl->N(for forward search)
, vim lists down all options available or completes it.
And Yes it works even for header files.
To make this work you should install ctags
In usr/include
add:
ctags -f ~/.vim/stdtags -R --c++-kinds=+p --fields=+iaS --extra=+q .
Add this to your .vimrc
set nocp
filetype plugin on
map <C-L> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR><CR>
set tags=~/.vim/stdtags,tags,.tags,../tags
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
Upvotes: 2