user4918296
user4918296

Reputation:

Vim youcompleteme not working in Debian Jessie

According to this article code completion should work for any language with youcompleteme plugin. I set it up as follows in Debian Jessie:

  • installed vim from repository
  • installed youcompleteme from repository
  • issued 'vam install youcompleteme' in cli

After the last step vim start significantly slower, which means that it is loading the plugin. However, completion does not work. The output of

$ vam status
Name                     User Status  System Status 
editexisting                removed       removed       
justify                     installed     removed       
matchit                     removed       removed       
youcompleteme               installed     removed       

Is there anything else I have to do to get youcompleteme working?

Upvotes: 6

Views: 6980

Answers (2)

user4918296
user4918296

Reputation:

I contacted the maintainer and finally got the missing hint. As it turns out, all I had left to do was to enable filetype recognition. In case someone else struggles with this, here are some instructions on how to setup Vim with the Debian package vim-youcompleteme.

Install vim and vim-youcompleteme packages

$ sudo apt-get install vim vim-youcompleteme

This will also install any required dependencies automatically. Afterwards you will have to issue the following command

$ vam install youcompleteme

The last command will create ~/.vim folder in your home folder. However, code completion does not work yet. Some further modifications are required. First copy the default ycm_extra_conf.py file to the newly created ~/.vim/ folder

$ cp /usr/share/doc/vim-youcompleteme/examples/ycm_extra_conf.py ~/.vim/.ycm_extra_conf.py

Then we need to tell vim to use this file for code completion in our .vim.rc and to turn on filetype recognition. The following two lines should be added to ~/.vimrc:

let g:ycm_global_ycm_extra_conf = "~/.vim/.ycm_extra_conf.py"
filetype on

Now vim should be able to use code completion, e.g., with C++ files.

Upvotes: 19

cbaumhardt
cbaumhardt

Reputation: 303

You should follow the installation instructions for YCM, including how to compile it:

Install development tools and CMake: sudo apt-get install build-essential cmake

Make sure you have Python headers installed: sudo apt-get install python-dev.

Compiling YCM with semantic support for C-family languages:

cd ~/.vim/bundle/YouCompleteMe ./install.py --clang-completer

Compiling YCM without semantic support for C-family languages:

cd ~/.vim/bundle/YouCompleteMe ./install.py

Also, I would give you the tip to use vim-plug for handling plugins.

Upvotes: 0

Related Questions