created February 16, 2008 · complexity basic · author Metacosm · version 7.0
Omni completion provides smart autocompletion for programs. When invoked, the text before the cursor is inspected to guess what might follow. A popup menu offers word completion choices that may include struct and class members, system functions, and more. A similar feature in Microsoft Visual Studio is known as IntelliSense.
Overview[edit | edit source]
Omni completion is not usually enabled by default. To turn on omni completion, add the following to your vimrc:
filetype plugin on set omnifunc=syntaxcomplete#Complete
When generating a tags file, Exuberant Ctags should be used. Windows users need to install a recent version of Exuberant Ctags (Ctags 5.7, released September 2007, or newer, is recommended). :help ft-c-omni
Using omni completion[edit | edit source]
To use omni completion, type
<C-X><C-O> while open in Insert mode.
If matching names are found, a pop-up menu opens which can be navigated using the
Related tips[edit | edit source]
- This is to be an overview of omnicompletion, with links to more detailed tips as required.
- Need to make sense of related tips, and probably merge a few.
- Meanwhile, keep the following list as a useful reference for readers and editors.
Popup menu and mappings
- 102 Smart mapping for tab completion
- 1228 Improve completion popup menu
- 1257 Ctrl-p - autocomplete
- 1386 Make Vim completion popup menu work just like in an IDE
- 1486 Omni completion popup menu
Random thoughts on IDE
Usage with C++
- See C++ code completion for omni completion in C++ programs.
Usage with Python
- 1311 Compile a separate copy of Vim for Python coding
- 1548 Continue omnicompletion for python modules