Vim 7.0 and later versions have built-in auto-completion, with the same shortcut key as omnicppcomplete.
CTRL + x Ctrl + O (Intelligent completion)
Or Ctrl + n
Or Ctrl + P,
Or Ctrl + x Ctrl + f (fill in the file name)
CTRL + X is to enter a mode.
However, if the omnicppcomplete plug-in is used, you cannot enter "." "->" automatically and intelligently.
To automatically complete STL, You need to download the STL source code, generate the tags file from the STL source code, and write the file to vimrc.
CTRL +] You can only enter a defined function, not a declared function.
Make sure that the VI compatibility mode is disabled and file type detection is allowed:
Set nocp
Filetype plugin on
Generate Tag file
Ctags-r -- C ++-kinds = + p -- fields = + IAS -- extra = + q.
When completing the C ++ file, the omnicppcomplete plug-in requires the Tag file to contain additional C ++ information. Therefore, the ctags command above is different from the one we used previously, it generates additional information for the c ++ language. The meanings of the preceding options are as follows:
-- C ++-kinds = + P: add the function prototype label to the C ++ file.
-- Fields = + IAS: Add Inheritance Information (I), access control information (a) of Class Members, and function fingerprint (s) to the Tag file)
-- Extra = + Q: Add a class modifier to the tag. Note: If this option is not available, the class members cannot be supplemented.