This page covers how to setup and use YouCompleteMe (Ycm) to enable autocompletion for Gecko/Mozilla-Central development. Setup times will take about ~15 minutes.

Setup (Vim)

  • Make sure you're running vim 7.4 or later. On Mac I found it easier to run 'brew install vim' and replace the system vim by creating a symbolic link at /usr/bin/vim OR you can use MacVim. Both should work now. If you using MacPorts you can use something like 'port install vim +python27'
  • Install Vundle (the plugin manager that the YouCompleteMe docs recommend, although you can use vim-plug instead):
git clone ~/.vim/bundle/Vundle.vim
  • Add the following to the start of your .vimrc:
" Vundle vimrc
set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" Gecko includes a file in the root directory.
" Update this glob path to your Gecko source code location.
let g:ycm_extra_conf_globlist = ['~/dev/gecko/*']

" This is less secure, but this option will load any ycm config
" file found without a confirmation.
" let g:ycm_confirm_extra_conf = 0

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

Plugin 'ycm-core/YouCompleteMe'

" End configuration, makes the plugins available
call vundle#end()
filetype plugin indent on
  • Consider all adding the following to your .vimrc if you want to use CTRL+]:
map <C-]> :YcmCompleter GoToImprecise<CR>

OSX: If Ycm is having trouble finding system headers, or just in case, run the following:

$ xcode-select --install

  • Finally do a full non-artifact build to enable the completions by running ./mach build. The script will properly query the obj directory with the correct include paths and compiler flags.

Setup (Emacs)

  • Use the emacs-ycmd package. Follow the setup from the README. It's available from MELPA.

Reporting a Bug

If you encounter any issues please file a bug and make it depend on bug 892973.


Add your tips here

  • Use ':YcmDiag' if the file is showing unexpected error or completion issue(s). This will show the errors that clang is hitting.
  • If you don't want to see the preview window after insertion, please try to add "g:ycm_autoclose_preview_window_after_insertion = 1" into your "~/.vimrc".