Home Explore Blog CI



neovim

15th chunk of `runtime/doc/insert.txt`
5f32ba3ea568fd59bfa33c3db33394445ca76c54890cd85b0000000100000fa0

Completion is context-sensitive.  It works like on the Command-line.  It
completes an Ex command as well as its arguments.  This is useful when writing
a Vim script.

							*i_CTRL-X_CTRL-V*
CTRL-X CTRL-V		Guess what kind of item is in front of the cursor and
			find the first match for it.
			Note: When CTRL-V is mapped you can often use CTRL-Q
			instead of |i_CTRL-Q|.
	CTRL-V	or
	CTRL-N		Search forwards for next match.  This match replaces
			the previous one.

	CTRL-P		Search backwards for previous match.  This match
			replaces the previous one.

	CTRL-X CTRL-V	Further use of CTRL-X CTRL-V will do the same as
			CTRL-V.  This allows mapping a key to do Vim command
			completion, for example: >
				:imap <Tab> <C-X><C-V>

Completing contents from registers			*compl-register-words*
							*i_CTRL-X_CTRL-R*
CTRL-X CTRL-R		Guess what kind of item is in front of the cursor from
			all registers and find the first match for it.
			Further use of CTRL-R (without CTRL-X) will insert the
			register content, see |i_CTRL-R|.
			'ignorecase' applies to the matching.

	CTRL-N		Search forwards for next match.  This match replaces
			the previous one.

	CTRL-P		Search backwards for previous match.  This match
			replaces the previous one.

	CTRL-X CTRL-R	Further use of CTRL-X CTRL-R will copy the line
			following the previous expansion in other contexts
			unless a double CTRL-X is used (e.g. this switches
			from completing register words to register contents).

User defined completion					*compl-function*

Completion is done by a function that can be defined by the user with the
'completefunc' option.  See below for how the function is called and an
example |complete-functions|.

							*i_CTRL-X_CTRL-U*
CTRL-X CTRL-U		Guess what kind of item is in front of the cursor and
			find the first match for it.
	CTRL-U	or
	CTRL-N		Use the next match.  This match replaces the previous
			one.

	CTRL-P		Use the previous match.  This match replaces the
			previous one.


Omni completion					*omnicompletion* *compl-omni*

Completion is done by a function that can be defined by the user with the
'omnifunc' option.  This is to be used for filetype-specific completion.

See below for how the function is called and an example |complete-functions|.
For remarks about specific filetypes see |compl-omni-filetypes|.
More completion scripts will appear, check www.vim.org.  Currently there is a
first version for C++.

							*i_CTRL-X_CTRL-O*
CTRL-X CTRL-O		Guess what kind of item is in front of the cursor and
			find the first match for it.
	CTRL-O	or
	CTRL-N		Use the next match.  This match replaces the previous
			one.

	CTRL-P		Use the previous match.  This match replaces the
			previous one.


Spelling suggestions					*compl-spelling*

A word before or at the cursor is located and correctly spelled words are
suggested to replace it.  If there is a badly spelled word in the line, before
or under the cursor, the cursor is moved to after it.  Otherwise the word just
before the cursor is used for suggestions, even though it isn't badly spelled.

NOTE: CTRL-S suspends display in many Unix terminals.  Use 's' instead.  Type
CTRL-Q to resume displaying.

						*i_CTRL-X_CTRL-S* *i_CTRL-X_s*
CTRL-X CTRL-S   or
CTRL-X s		Locate the word in front of the cursor and find the
			first spell suggestion for it.
	CTRL-S	or
	CTRL-N		Use the next suggestion.  This replaces the previous
			one.  Note that you can't use 's' here.

	CTRL-P		Use the previous suggestion.  This replaces the
			previous one.


Completing keywords from different sources		*compl-generic*

							*i_CTRL-N*
CTRL-N			Find next match for words that start with the
			keyword in front of the cursor, looking in places
			specified with the 'complete' option.  The found
			keyword is inserted in front of the cursor.

							*i_CTRL-P*
CTRL-P			Find previous match for words that start with the
			keyword in front of the cursor, looking in places
			specified with the 'complete' option.  The found
		

Title: Register Content, User-Defined, Omni, Spelling, and Generic Completion
Summary
This section details additional completion modes in Vim, including register content completion (CTRL-X CTRL-R), which uses content from registers; user-defined completion (CTRL-X CTRL-U), employing a function defined by the user via the 'completefunc' option; omni completion (CTRL-X CTRL-O), using a filetype-specific function defined by the 'omnifunc' option; spelling suggestions (CTRL-X CTRL-S or CTRL-X s), which offers correctly spelled replacements for words; and generic completion (CTRL-N and CTRL-P), which finds matches for words starting with the keyword in front of the cursor, based on the 'complete' option.