Skip to content
Snell Rojas

Programming

Text Autocomplete in Vim

Vim doesn't autocomplete out of the box. Here's how to add it with Vundle and YouCompleteMe on Debian-based Linux like Ubuntu.

Snell RojasPublished Updated 2 min read

I wrote this post in Spanish in 2022 and adapted it to English in 2026.

One of the features of traditional text editors I missed most when I switched to Vim was autocomplete. Text autocomplete in Vim doesn't come out of the box.

Buuuuut...

That doesn't mean you can't add it and use it. It's just a matter of a few extra setup steps.

To add features to Vim, you need to install plugins, and Vundle makes that possible.

How to Install Vundle in Vim? #

First, we clone the project:

bash
$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

Now it's time to create the "plugins.vim" file inside the ~/.vim folder that was created when you cloned the project, and add this content:

Vim
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
let g:clang_c_options = '-std=gnu11'
Plugin 'VundleVim/Vundle.vim'

" (*) Add your <Plugin> lines here to add new plugins to Vim

call vundle#end() " required
filetype plugin indent on " required

Now edit your .vimrc file and add this line at the end:

Vim
so ~/.vim/plugins.vim

Then run this command in the terminal to install Vundle:

bash
$ vim +PluginInstall +qall

Now everything is ready to start installing plugins in Vim. For autocomplete, I'm going to use YouCompleteMe.

How to Install YouCompleteMe for Autocomplete in Vim? #

This is how to install it on Linux, for Debian-based distributions like my beloved Ubuntu.

Installing CMake, Vim and Python:

bash
$ sudo apt install build-essential cmake vim-nox python3-dev

Installing mono-complete, Go, Node, Java and npm:

bash
$ sudo apt install mono-complete golang nodejs default-jdk npm

Now you need to clone the YouCompleteMe project:

bash
git clone https://github.com/ycm-core/YouCompleteMe.git ~/.vim/bundle/YouCompleteMe

YouCompleteMe (YCM) has to be compiled to work, so you'll need to do this:

bash
$ cd ~/.vim/bundle/YouCompleteMe
$ python3 install.py --all

Adding YouCompleteMe So Vim Recognizes the Plugin #

Now that YCM is installed and compiled, all that's left is to tell Vim the plugin is available. For that, we'll edit the plugins.vim file like this:

Vim
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
let g:clang_c_options = '-std=gnu11'
Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
" (*) Add your <Plugin> lines here to add new plugins to Vim

call vundle#end() " required
filetype plugin indent on " required

With that, you'd have everything ready, and the result should look like the demo animation in the YouCompleteMe README.