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.
- 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 https://github.com/VundleVim/Vundle.vim ~/.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 .ycm_extra_conf.py 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 'Valloric/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>
- Launch vim and run :PluginInstall
- Build Ycm with the clang option. Follow the quick setup here: https://github.com/Valloric/YouCompleteMe
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
.ycm_extra_conf.pyscript will properly query the
objdirectory with the correct include paths and compiler flags.
- 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".