Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autocompletion in Vim

People also ask

Is there autocomplete in Vim?

Enter into the vim command mode by pressing the *Esc* key and Enter the below command. Now press the *Enter* key. Autocomplete is enabled for Javascript.


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.


You can use a plugin like AutoComplPop to get automatic code completion as you type.

2015 Edit: I personally use YouCompleteMe now.


If you are using VIM version 8+, just type Ctrl + n or Ctrl + p.


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.


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


Another option is coc.nvim.

It's really fast and the completion is great as it uses intellisense the same autocompletion as VScode has. It also has linting capabilities. So it shows you were you might have a bug. It supports a multitude of languages.

It might take a bit to set up and configure but I thing it is the best autocompletion engine for vim out there.


I've used neocomplcache for about half a year. It is a plugin that collects a cache of words in all your buffers and then provides them for you to auto-complete with.

There is an array of screenshots on the project page in the previous link. Neocomplcache also has a ton of configuration options, of which there are basic examples on the project page as well.

If you need more depth, you can look at the relevant section in my vimrc - just search for the word neocomplcache.