DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Install YouCompleteMe for vim


Install

Install YCM on Ubuntu 14.04:

sudo apt install build-essential cmake 
sudo apt install python-dev python3-dev

# Add `Plugin 'Valloric/YouCompleteMe'` into .vimrc.
vim +PluginClean +PluginInstall
cd ~/.vim/bundle/YouCompleteMe
./install.py

Take about one hour (16:44 ~ 17:44 ) when running vim +PluginClean +PluginInstall (about 200MB for the repo).

If your vim version is lower than 7.4.143, you must install a newer version vim:

sudo add-apt-repository ppa:pkg-vim/vim-daily
sudo apt-get update
sudo apt-get install vim
dpkg -s vim | grep 'Version'    # should be greater than 7.41

Or the following error occurs:

Error detected while processing function youcompleteme#Enable..<SNR>74_OnBufferRead:
line   17:
E117: Unknown function: UltiSnips#SnippetsInCurrentScope
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>74_OnBufferRead:
line   17:
E15: Invalid expression: UltiSnips#SnippetsInCurrentScope( 1 )

Ref: https://github.com/Valloric/YouCompleteMe/issues/2335

Config

To change the default color of the autocomplete window of YCM, add the following codes into .vimrc after syntax on:

" autocomplete window color for plugin YouCompleteMe
highlight Pmenu ctermfg=white ctermbg=black
highlight PmenuSel ctermfg=green ctermbg=black
nnoremap <leader>y :let g:ycm_auto_trigger=0<CR>
nnoremap <leader>Y :let g:ycm_auto_trigger=1<CR>

Use Y/y to turn on/off autocomplete.

Notes

Remove vim daily PPA

Remove vim daily PPA with:

$ sudo add-apt-repository -r ppa:pkg-vim/vim-daily
$ apt-key list
/etc/apt/trusted.gpg.d/pkg-vim-vim-daily.gpg
--------------------------------------------
pub   4096R/D31525A0 2014-10-15
uid                  Launchpad PPA for pkg-vim
$ sudo apt-key del D31525A0 

Use apt-get with proxy:

When it's very slow when running apt update, add Defaults env_keep = "http_proxy https_proxy ftp_proxy" after Defaults env_reset with sudo visudo. Then run:

export http_proxy=http://duotai:7jSF81tGRYK@conrad.h.xduotai.com:15617
export https_proxy=$http_proxy
sudo apt update

The proxy url in above export command is provide by 多态.

Fix error in apt update

Fix the following error with sudo apt update uk-keyring:

Reading package lists... Done
W: GPG error: http://archive.ubuntukylin.com:10006 xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8D5A09DC9B929006

This error is introduced by Sogou Pinyin, in file: /etc/apt/sources.list.d/sogoupinyin.list.

Ref: http://www.ubuntukylin.com/ukylin/forum.php?mod=viewthread&tid=25955



Published

Oct 1, 2016

Last Updated

Oct 1, 2016

Category

Tech

Tags

  • vim 92
  • YouCompleteMe 1

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor