place element in suggestion list. When
both major engines implemented element, even if this is not in standards it
will be suggested. All other elements are not placed in suggestion list.
LUA *ft-lua-omni*
Lua |ftplugin| sets 'omnifunc' to |vim.lua_omnifunc()|.
PHP *ft-php-omni*
Completion of PHP code requires a tags file for completion of data from
external files and for class aware completion. You should use Universal/
Exuberant ctags version 5.5.4 or newer. You can find it here:
Universal Ctags: https://ctags.io
Script completes:
- after $ variables name
- if variable was declared as object add "->", if tags file is available show
name of class
- after "->" complete only function and variable names specific for given
class. To find class location and contents tags file is required. Because
PHP isn't strongly typed language user can use @var tag to declare class: >
/* @var $myVar myClass */
$myVar->
<
Still, to find myClass contents tags file is required.
- function names with additional info:
- in case of built-in functions list of possible arguments and after | type
data returned by function
- in case of user function arguments and name of file where function was
defined (if it is not current file)
- constants names
- class names after "new" declaration
Note: when doing completion first time Vim will load all necessary data into
memory. It may take several seconds. After next use of completion delay
should not be noticeable.
Script detects if cursor is inside <?php ?> tags. If it is outside it will
automatically switch to HTML/CSS/JavaScript completion. Note: contrary to
original HTML files completion of tags (and only tags) isn't context aware.
RUBY *ft-ruby-omni*
NOTE: |compl-omni| for Ruby code requires |provider-ruby| to be installed.
Ruby completion will parse your buffer on demand in order to provide a list of
completions. These completions will be drawn from modules loaded by "require"
and modules defined in the current buffer.
The completions provided by CTRL-X CTRL-O are sensitive to the context:
CONTEXT COMPLETIONS PROVIDED ~
1. Not inside a class definition Classes, constants and globals
2. Inside a class definition Methods or constants defined in the class
3. After '.', '::' or ':' Methods applicable to the object being
dereferenced
4. After ':' or ':foo' Symbol name (beginning with "foo")
Notes:
- Vim will load/evaluate code in order to provide completions. This may
cause some code execution, which may be a concern. This is no longer
enabled by default, to enable this feature add >
let g:rubycomplete_buffer_loading = 1
<- In context 1 above, Vim can parse the entire buffer to add a list of
classes to the completion results. This feature is turned off by default,
to enable it add >
let g:rubycomplete_classes_in_global = 1
< to your vimrc
- In context 2 above, anonymous classes are not supported.
- In context 3 above, Vim will attempt to determine the methods supported by
the object.
- Vim can detect and load the Rails environment for files within a rails
project. The feature is disabled by default, to enable it add >
let g:rubycomplete_rails = 1
< to your vimrc
SYNTAX *ft-syntax-omni*
Vim has the ability to color syntax highlight nearly 500 languages. Part of
this highlighting includes knowing what keywords are part of a language. Many
filetypes already have custom completion scripts written for them, the
syntaxcomplete plugin provides basic completion for all other filetypes. It
does this by populating the omni completion list with the text Vim already
knows how to color highlight. It can be used for any filetype and provides a
minimal language-sensitive completion.
To enable syntax code completion you can run: >
setlocal omnifunc=syntaxcomplete#Complete
You can automate this by placing