Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
YCM on my Manjaro system

Building YCM on Manjaro

YouCompleteMe, the Vim code-completion engine, on my laptop running with Manjaro. This is extracted from the full installation guide.

Sifting through YCM's documentation is a pain, so I'm preserving the steps that work on my system and fit my personal requirements. Those are:

  • Use system-provided clang library.
    • Docs recommend using clang versions >= 3.8. My distro provides this.
  • Provide auto-completion support for C-family languages.
  • Do not use system-provided version of boost.

Check vim requirements

  • vim version >= 7.4.143
    • :version
  • check for python support:
    • :echo has('python') || has('python3')

Install YCM

  • Add Vallorc/YouCompleteMe to your vimrc
  • type :PluginInstall from inside of vim.

Support auto-completion for C-family languages

For completion support for C-family languages, install clang:

  • pacman -S clang

Compile libraries

Take these steps to compile:

YCM_BUILD_DIR=$HOME/builds/ycm_build
mkdir -p $YCM_BUILD_DIR && cd $YCM_BUILD_DIR
rm ./* -rf

# Generate the make files
cmake -G "Unix Makefiles" \
  -DUSE_SYSTEM_LIBCLANG=ON \
  . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp

# Compile:
cmake --build . --target ycm_core

Set up support for additional languages

YCM_3RD_PARTY_DIR=$HOME/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party

function make_err_msg() {
  local cmd=$1
  echo "$cmd executable not found. Please install $cmd, add to PATH. Then build YCM support"
}

# build go support
if [[ -x $(which go) ]]; then
  cd "$YCM_3RD_PARTY_DIR/gocode"
  pwd
  go build
else
  make_err_msg go
fi

# build typescript
if [[ -x $(which npm) ]]; then
  npm install -g typescript
else
  make_err_msg 'node & npm'
fi

# build js support
if [[ -x $(which npm) ]]; then
  cd "$YCM_3RD_PARTY_DIR/tern_runtime"
  pwd
  npm install --production
else
  make_err_msg 'node & npm'
fi

# build rust support
if [[ -x $(which cargo) ]]; then
  cd "$YCM_3RD_PARTY_DIR/racerd"
  pwd
  cargo build --release
else
  make_err_msg 'rust & cargo'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.