Santosh Kumar
Santosh Kumar

Reputation: 27875

How do I supress unexpected word completion suggestion in 'c' filetype?

When working with filetypes other than c I only get suggestion from all open buffers (using supertab). But when I hit Tab to do word completion in c filetypes I get suggestions from system wide C header files which are useless to me (specially when number of suggestions are more to navigate).

I don't think any of my plugins are interfering in this. I don't want suggestions from header files. Please, what can I do?

Upvotes: 0

Views: 74

Answers (1)

Jan Hudec
Jan Hudec

Reputation: 76276

There are some default plugins interfering. The option 'complete' selects which completion sources you are interested in. The possible ones are:

  1. current buffer
  2. buffers from other windows
  3. other loaded buffers that are in the buffer list
  4. unloaded buffers that are in the buffer list
  5. buffers that are not in the buffer list
  6. files given with the 'dictionary' option
  7. currently active spell checking (see spell)
  8. files given with the 'thesaurus' option
  9. additional dictionary files given in 'copmplete' option with behaviour similar to 'dictionary' and 'thesaurus'
  10. current and included files
  11. tags

The default setting is:

  1. the current buffer
  2. buffers in other windows
  3. other loaded buffers
  4. unloaded buffers
  5. tags
  6. included files

The last or the next-to-last item is interfering with your usage. The included files are searched based on options

  • 'include' defines patter for finding include directives. The default value is appropriate for C files, so this completion mode kicks in in C (and C++) files and not much anywhere else.
  • 'path' defines where the include files are searched. Check whether you have /usr/include there.
  • 'tags' defines list of "tags" files to use by relative or absolute paths. You might have /usr/include/tags there.

You can disable these completions by either removing respective flags from 'complete' option or by removing /usr/include from 'path' and/or /usr/include/tags from 'tags'. The completion modes are default, but the paths shouldn't be (/usr/include/tags is a vi default, but not vim default, so it shouldn't be used if you've set 'nocompatible').

Note, that tags will always complete from all system files, since it uses an index of symbols, while include will only complete from actually (even indirectly) included files.

Upvotes: 2

Related Questions