Home Explore Blog CI



neovim

20th chunk of `runtime/doc/insert.txt`
6096dfbfeb5441c85be5878227d3253935090981157195470000000100000fa3
 insert a line break.
second state:	  Insert the currently selected match.
third state:	  Use the text as it is and insert a line break.

In other words: If you used the cursor keys to select another entry in the
list of matches then the <Enter> key inserts that match.  If you typed
something else then <Enter> inserts a line break.


The colors of the menu can be changed with these highlight groups:
Pmenu		normal item  |hl-Pmenu|
PmenuSel	selected item  |hl-PmenuSel|
PmenuSbar	scrollbar  |hl-PmenuSbar|
PmenuThumb	thumb of the scrollbar  |hl-PmenuThumb|

There are no special mappings for when the popup menu is visible.  However,
you can use an Insert mode mapping that checks the |pumvisible()| function to
do something different.  Example: >
	:inoremap <Down> <C-R>=pumvisible() ? "\<lt>C-N>" : "\<lt>Down>"<CR>

You can use of <expr> in mapping to have the popup menu used when typing a
character and some condition is met.  For example, for typing a dot: >
	inoremap <expr> . MayComplete()
	func MayComplete()
	    if (can complete)
	      return ".\<C-X>\<C-O>"
	    endif
	    return '.'
	endfunc

See |:map-<expr>| for more info.


FILETYPE-SPECIFIC REMARKS FOR OMNI COMPLETION	    *compl-omni-filetypes*

The file used for {filetype} should be autoload/{filetype}complete.vim
in 'runtimepath'.  Thus for "java" it is autoload/javacomplete.vim.


C							*ft-c-omni*

Completion of C code requires a tags file.  You should use Universal/
Exuberant ctags, because it adds extra information that is needed for
completion.  You can find it here:
	Universal Ctags: https://ctags.io

Universal Ctags is preferred, Exuberant Ctags is no longer maintained.

If you want to complete system functions you can do something like this.  Use
ctags to generate a tags file for all the system header files: >
	% ctags -R -f ~/.config/nvim/systags /usr/include /usr/local/include
In your vimrc file add this tags file to the 'tags' option: >
	set tags+=~/.config/nvim/systags

When using CTRL-X CTRL-O after a name without any "." or "->" it is completed
from the tags file directly.  This works for any identifier, also function
names.  If you want to complete a local variable name, which does not appear
in the tags file, use CTRL-P instead.

When using CTRL-X CTRL-O after something that has "." or "->" Vim will attempt
to recognize the type of the variable and figure out what members it has.
This means only members valid for the variable will be listed.

When a member name already was complete, CTRL-X CTRL-O will add a "." or
"->" for composite types.

Vim doesn't include a C compiler, only the most obviously formatted
declarations are recognized.  Preprocessor stuff may cause confusion.
When the same structure name appears in multiple places all possible members
are included.


CSS							*ft-css-omni*

Complete properties and their appropriate values according to CSS 2.1
specification.


HTML							*ft-html-omni*
XHTML							*ft-xhtml-omni*

CTRL-X CTRL-O provides completion of various elements of (X)HTML files.  It is
designed to support writing of XHTML 1.0 Strict files but will also work for
other versions of HTML. Features:

- after "<" complete tag name depending on context (no div suggestion inside
  of an a tag); '/>' indicates empty tags
- inside of tag complete proper attributes (no width attribute for an a tag);
  show also type of attribute; "*" indicates required attributes
- when attribute has limited number of possible values help to complete them
- complete names of entities
- complete values of "class" and "id" attributes with data obtained from
  <style> tag and included CSS files
- when completing value of "style" attribute or working inside of "style" tag
  switch to |ft-css-omni| completion
- when completing values of events attributes or working inside of "script"
  tag switch to |ft-javascript-omni| completion
- when used after "</" CTRL-X CTRL-O will close the last opened tag

Note: When used first time completion menu will be shown with little

Title: Popup Menu Customization and Filetype-Specific Remarks for Omni Completion
Summary
This section provides further details on Insert mode mappings and expression mappings for the popup menu, and how to use the pumvisible() function to customize behavior. It then discusses filetype-specific remarks for omni completion, focusing on C, CSS, HTML, and XHTML. For C, it recommends using Universal Ctags or Exuberant Ctags for completion and explains how to complete system functions and local variables. For CSS, it mentions the completion of properties and their values. For HTML and XHTML, it details the completion of tags, attributes, entities, and values, as well as the integration with CSS and JavaScript completion.