Neovim for Beginners — Built-in Completion
Completion is a broad topic to cover. We will start with the basics, and continue with completion plugins, LSP (Language Server Protocol) completion, and AI (Artificial Intelligence) completion in later articles.
In this article, we are going to
- Learn command-line completion
- Learn insert-mode completion
This article is part of the Neovim for Beginners series.
The Neovim configuration files can be found in this repository.
Command-line Completion
When we type :
to enter command-line mode, there are common commands that can help us to complete the word before the cursor (:h cmdline-competion
).
CTRL-D
List names that match the pattern in front of the cursor.
Tab
A match is done on the pattern in front of the cursor. The match (if there are several, the first match) is inserted in the place of the pattern.
We can change this command using the wildchar
(default to Tab
) option. E.g. if we type :set wildchar=<S-c>
, now instead of pressing Tab
, we need to type Shift + c
to get the completion.
S-Tab
By default, pressing Tab
selects the first match. Press S-Tab
if we want to select the last match.
CTRL-N, CTRL-P
We can press C-N
(next), C-P
(previous) to navigate to the next or previous match.
CTRL-G, CTRL-T
When incsearch
is set, entering a search pattern for /
or ?
and the current match is…