6

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?

4
  • You didn't give any details about which language isn't working or whether running :YcmDiag in vim gives any additional information. Nov 29, 2015 at 16:49
  • When I issue :YcmDiag I get: Native filetype completion not supported for current file, cannot force recompilation. I tried to edit a java file. I also tried editing a c++ which also did not work.
    – user4918296
    Nov 29, 2015 at 19:03
  • You still haven't specified which language. Nov 29, 2015 at 20:00
  • What exactly do you mean by language? I tried, as previously stated, Java and C++. Or do you mean which locale settings I use in my Terminal?
    – user4918296
    Nov 29, 2015 at 20:04

2 Answers 2

19

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.

2
  • 10
    These instructions were spot on, except that in Debian Buster I found the example python config file at /usr/lib/ycmd/ycm_extra_conf.py.
    – Yankee
    Jul 5, 2017 at 2:50
  • On Debian 10 I just installed the packages and executed vam install youcompleteme and this works. But C syntax won't work as packages don't install a file ycm_extra_conf.py. You can check with dpkg-query -L vim-youcompleteme. But somehow this file is in /usr/lib/ycmd/ycm_extra_conf.py (Thanks @Yankee). How come this is installed here when those packages don't install it?
    – 71GA
    Jan 3, 2020 at 19:15
0

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.

5
  • 4
    I do not want to compile it. That is the whole point of using a distro like Debian in the first place. I want the version in the repositories to work. If it does not, and unless i missed something, then I will file a bug.
    – user4918296
    Nov 29, 2015 at 14:07
  • This is totally unrelated to Debian. If you want to use YouCompleteMe (a Vim plugin unrelated to any operating system), you need to compile it to get it to work. This is not a bug and will not change. The reason you need to compile it is that in order to be very fast, the plugin uses C/C++ code, which only runs when compiled. This is different from many other Vim plugins written in pure Vimscript or Python (which don't need to be compileD).
    – cbaumhardt
    Nov 29, 2015 at 14:13
  • 1
    Then what is the point of having the package youcompleteme in the repository?
    – user4918296
    Nov 29, 2015 at 14:52
  • I think you understand something wrong here. The "repository" you probably talk about is the Debian package management system. It includes lots of things you can install via apt-get install programname. The packages in this "repository" don't need to be compiled, they work out of the box for you. YouCompleteMe is NOT a Debian package. It is a piece of software unrelated to Debian, which you will find ONLY on Github. Github is a place where people have their source code, which sometimes needs to be compiled, sometimes works out of the box. You cannot install YCM via apt-get install.
    – cbaumhardt
    Nov 29, 2015 at 15:05
  • 3
    @cbaumhardt, no. There is a Debian package for youcompleteme which has the compiled library included. The OP has a different problem. Nov 29, 2015 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy