

























Some words are hard to type, it is handy if Neovim can provide auto-completion for the words we are typing. We can achieve word completion in Neovim in two ways.
The first method is to use a dictionary file. The dictionary file is a text file which contains plain English words, usually one word a line. In the Neovim config file, add the following settings for dictionary option:
if has('unix')
set dictionary+=/usr/share/dict/words
else
set dictionary+=~/AppData/Local/nvim/words
endifFor Linux systems, the dictionary file is usually /usr/share/dict/words. For
Windows, there is no dictionary file. But you can copy the Linux dict file and
place it under ~/AppData/Local/nvim/.
Then start editing a file, type the first several characters of a word, then
press
, the
completion items will be shown on a completion menu. Typing <CTRL-X><CTRL-K>
is cumbersome. You can add the following setting to
complete option:
Now, in insert mode, you can press <CTRL-N> to start auto-completion and move
selection to next word in the completion menu, while pressing <CTRL-P> will
move the selection to the previous word.
The second method is to install
deoplete-spell. If you have
installed deoplete, the only setting
you need is :set spell. Then you should be able to see the autocompletion
menu when you start typing characters.
There is also a plugin called neco-look
which uses the look command on Linux system to provide auto-completion. But
it does not work natively on Windows.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。