How to make Vim autocomplete a word based on words already in the buffer?
How can I make Vim autocomplete words, based on words already found in the buffer, just like it is possible with Emacs (M-%)?
<C-n>
and <C-p>
will complete what is in all buffers. <C-x><C-n>
and <C-x><C-p>
will do exactly what you asked for and only give completion for tokens in the current buffer. However, there are a lot of completion options in Vim. To learn more about them, I would suggest reading the help section on them :help ins-completion
(this is called insert mode completion).
A few other completion options in Vim are <C-x><C-f>
to complete file paths and <C-x><C-l>
to complete entire lines.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With