0 votes
in VIM by
How do you use the Vim keyword completion feature? Can you provide some examples?

1 Answer

0 votes
by

Vim’s keyword completion feature is activated using the Ctrl-n and Ctrl-p shortcuts. When in insert mode, type the beginning of a word then press Ctrl-n or Ctrl-p to cycle through matching words found in all buffers. The matches are displayed in a pop-up menu where you can select the desired one.

For example, if you have typed “funct” and want to complete it as “function”, pressing Ctrl-n will show a list of words starting with “funct”. If “function” appears, navigate to it using Ctrl-n or Ctrl-p and press Enter to select it.

You can also use this feature across multiple files. Vim searches for matches in all open buffers, not just the current file. So, if you’ve used a term in another file that’s still open in Vim, you can quickly auto-complete it in your current file.

Related questions

0 votes
asked May 12 in JAVA by rahuljain1
0 votes
asked Apr 24 in JAVA by Robin
...