Intelligent code completion in C++ is best done with YouCompleteMe in my opinion. It’s fast, precise, clever and easy to install. However, default installation occupies much space in file system. For example, after just python2 install.py --clang-completer:

Default space usage

Thus, half of a gigabyte for C#, Go, Rust completion engines, boost and clang copies. It’s a good thing to have self-contained deployment, independent from specific distribution environment. But I’d like to have more compact installation.

First step was to use system libclang and boost. This isn’t recommended by the plugin author, by the way. After adding tuning the build to python2 install.py --clang-completer --system-libclang --system-boost:

Space usage with system libraries

Still a quarter of gigabyte. Then drastic cut: implement custom deployment. The script update-ycm.sh does few things:

  • Clones the latest version of YouCompleteMe from github
  • Builds it with clang completer enabled linking with system libraries
  • Removes fat bits and pieces
  • Deploys the stripped plugin into ~/.vim
  • Updates global ycm_extra_conf.py to match include paths of system clang.

Finally, I like the space usage of what’s left:

Stripped custom deployment

Happy coding!