vim's autocomplete: how to prevent vim to read some include files?

10

2

Vim has handy Ctrl-N key that autocompletes word under the cursor with word in current file or any included file. If Once I include boost library, this feature becomes absolutely useless because it takes dozens of seconds to read whole boost includes and I really do not want to complete anything which is defined in boost anyway. So how can I tell vim to ignore /usr/include/boost directory when looking for include files? Oh how I can set 'include' option to ignore any #include <boost/.*> ?

anonymous

Posted 2009-12-02T13:54:44.713

Reputation:

Answers

16

The option you're looking for is 'complete', but it doesn't define the granularity you're asking for. All you can do is specify whether or not to scan included files. To disable scanning of all included files, you can

set complete-=i

Otherwise, setting 'include' to ignore boost may be your best option.

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

Note that, as I mentioned in my other comment, you shouldn't use " to specify the option as that is Vim's comment character. Instead, you need to escape the spaces.

jamessan

Posted 2009-12-02T13:54:44.713

Reputation: 1 021

1

Ok, I found answer to second part:

set include="#include \\(<boost\\)\\@!"

anonymous

Posted 2009-12-02T13:54:44.713

Reputation:

Actually, you've just unset the include option. " is Vim's comment character, so you essentially ran 'set include='. – jamessan – 2009-12-02T17:58:24.110