Reputation: 698
I often use VIM auto-complete (CTRL+N\P) facility, it recognizes enums or defines (string based I guess) that are only in the set of current open files. In order to overcome this, I usually open a header file that contain all the enums\defines in a new tab, and then the auto-complete has all the values.
I wonder if there were a way to include this file in the default set of files that vim looks in when it searches for the auto-complete.
Thanks.
Upvotes: 1
Views: 2350
Reputation: 5112
Also consider the 'include'
option. Assuming that 'complete'
includes the i
flag (which is part of the default), vim will automatically search included files. The default value of 'include'
recognizes C-style include statements:
#include "foo.h"
If you are editing some other language, then you may want to choose a different setting, probably in an ftplugin file.
:help 'complete'
:help 'include'
:help 'path'
Upvotes: 1
Reputation: 196516
With the default value of the complete
option, <C-n>
and <C-p>
should complete using your include files. You may wish to adjust the path
option, though (see :help 'path'
).
You can also use the following command to tell Vim to use /path/to/file
as a dictionary completion source:
:set complete+=k/path/to/file
See :help 'complete'
.
Upvotes: 6