Autocompletion in Vim
Solution 1:
Use Ctrl-N to get a list of word suggestions while in insert mode. Type :help i_CTRL-N
to see Vim's documentation on this functionality.
Here is an example of importing the Python dictionary into Vim.
Solution 2:
You can use a plugin like AutoComplPop to get automatic code completion as you type.
2015 Edit: I personally use YouCompleteMe now.
Solution 3:
If you are using VIM version 8+, just type Ctrl + n
or Ctrl + p
.
Solution 4:
You can start from built-in omnifunc
setting.
Just put:
filetype plugin on
au FileType php setl ofu=phpcomplete#CompletePHP
au FileType ruby,eruby setl ofu=rubycomplete#Complete
au FileType html,xhtml setl ofu=htmlcomplete#CompleteTags
au FileType c setl ofu=ccomplete#CompleteCpp
au FileType css setl ofu=csscomplete#CompleteCSS
on the bottom of your .vimrc
, then type <Ctrl-X><Ctrl-O>
in insert mode.
I always rely on this CSS completion.
Solution 5:
There is also https://github.com/Valloric/YouCompleteMe and it includes things like Jedi and also has fuzzy match. So far I found YCM to be the fastest among what I have tried.
Edit: There also exists some new ones like https://github.com/maralla/completor.vim