Installing YouCompleteMe Plugin for Vim in Ubuntu

The YouCompleteMe plugin (YCM) provides “Intellisense-like” features within Vim. Setting it up requires several steps:

  1. Install the plugin using any Vim plugin manager. For example, if you use Vundle, you would add to your .vimrc:
    • Plugin ‘Valloric/YouCompleteMe’
  2. Install development tools:
    • sudo apt install build-essential cmake python3-dev
  3. Install Ubuntu packages on which YCM depends for the programming languages you plan on using:
    1. For C and C++ support: sudo apt install clang-8 libclang1-8 clang-tools-8
    2. For C# support: sudo apt install mono-complete
    3. For JavaScript and TypeScript: sudo apt install nodejs npm
    4. For others, see the YCM documentation at https://github.com/ycm-core/YouCompleteMe
  4. Run the YCM install.py script with flags appropriate to the above languages:
    • For C and C++: --clang-completer
    • For C#: –cs-completer
    • –ts-completer
    • For example, if you want support for all three of the above language groups, you would do:
      • cd ~/.vim/bundle/YouCompleteMe
      • python3 ./install.py –clang-completer –cs-completer –ts-completer