Search code examples
vimboostclangcode-completionclang-complete

How to reduce the time of clang_complete search through boost


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

  1. I type a name of a variable.
  2. I press ^N. Vim starts to search through boost tree. it auto-completes the variable.
  3. i press "." and get the following errors:
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/\\)\\@!


Solution

  • from here, you can add the following to your .vimrc:

    :set include=^\\s*#\\s*include\ \\(<boost/\\)\\@!
    

    (the question of caching the search through boost is still open though)