I like using clang with vim.
The one problem that I always have is that whenever I include boost, clang goes through boost library every time I put "." after a an object name. It takes 5-10 seconds.
Since I don't make changes to boost headers, is there a way to cache the search through boost? If not, is there a way to remove boost from the auto-completion search?
update (1) in response to answer by adaszko after :let g:clang_use_library = 1
Error detected while processing function ClangComplete: line 35: Traceback (most recent call last): Press ENTER or type command to continue Error detected while processing function ClangComplete: line 35: File "<string>", line 1, in <module> Press ENTER or type command to continue Error detected while processing function ClangComplete: line 35: NameError: name 'vim' is not defined Press ENTER or type command to continue Error detected while processing function ClangComplete: line 40: E121: Undefined variable: l:res Press ENTER or type command to continue Error detected while processing function ClangComplete: line 40: E15: Invalid expression: l:res Press ENTER or type command to continue Error detected while processing function ClangComplete: line 58: E121: Undefined variable: l:res Press ENTER or type command to continue Error detected while processing function ClangComplete: line 58: E15: Invalid expression: l:res Press ENTER or type command to continue
... and there is no auto-compeltion
update (2)
not sure if clang_complete should take care of the issue with boost. vim without plugins does search through boost.
superuser has an answer to comment out search through boost dirs with set include=^\\s*#\\s*include\ \\(<boost/\\)\\@!
So, you have at least two options. Option #1 is to set g:clang_use_library
to 1
. Here's what :help g:clang_use_library
says about it:
Instead of calling the clang/clang++ tool use libclang directly. This
gives access to many more clang features. Furthermore it automatically
caches all includes in memory. Updates after changes in the same file will
therefore be a lot faster.
This requires working setup of Python Vim integration though.
Option #2 is to set g:clang_complete_auto
to 0
by which you disable
automatic completion after ->
, .
, ::
and may use <C-x> <C-o>
instead
to manually invoke clang_complete whenever you wish.
I use both.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With