2015-05-06 90 views
5

我想開發C/C++程序,所以我通過Vundle安裝了Vim的YouCompleteMe,但它無法正常工作,實際上,它只顯示當前文件中包含的文字。幫幫我! 我的步驟如下:YouCompleteMe無法自動完成

  • 下載Vundle.vim
 
    git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim 
  • #modify的.vimrc
 

    set nocompatible 
    filetype off 
    set rtp+=~/.vim/bundle/Vundle.vim 
    call vundle#begin() 
    Plugin 'gmarik/Vundle.vim' 
    Plugin 'Valloric/YouCompleteMe' 
    call vundle#end() 
    filetype plugin indent on 

  • 啓動vim和運行:
`:PluginInstall`
  • 下載cmake並鐺+ LLVM
 

    http://llvm.org/releases/download.html#3.6.0 
    http://www.cmake.org/download/ 

  • 準備鐺和cmake的
 

    Extract "clang+llvm-3.6.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz" into ycm_temp 
    Rename "clang+llvm-3.6.0-x86_64-linux-gnu" to "llvm_root_dir" 
    Extract cmake-3.2.2-Linux-x86_64.tar.gz and Link bin/cmake to /usr/bin/cmake 

  • 使
 

    cd ~ 
    mkdir ycm_build 
    cd ycm_build 
    cmake -G "Unix Makefiles" -DPATH_TO_LLVM_ROOT=~/ycm_temp/llvm_root_dir . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp 
    make ycm_support_libs 

  • 修改的.vimrc
 

    let g:ycm_seed_identifiers_with_syntax=1 
    let g:ycm_global_ycm_extra_conf = '/home/li/.vim/bundle/YouCompleteMe/.ycm_extra_conf.py' 
    let g:ycm_confirm_extra_conf=0 
    let g:ycm_collect_identifiers_from_tag_files = 1 
    set completeopt=longest,menu 

現在,沒有錯誤或警告被拋出,但它不能自動完成C/C++頭文件!

 
OS:ubuntu 14.04 
vim:7.4 
Python:2.7.6 
+0

你運行'運行./install.sh --clang,completer'? – FDinoff

+0

是的,我剛跑過,但問題仍然是... –

+0

':YcmDebugInfo'的輸出是什麼? – FDinoff

回答

4

請與快捷鍵Ctrl-X + Ctrl-O鍵的全完成(功能)。

這將引發全功能,

和/或從下面的鏈接下載.ycm_extra_conf.py >>https://github.com/rasendubi/dotfiles/blob/d534c5fb6bf39f0d9c8668b564ab68b6e3a3eb78/.vim/.ycm_extra_conf.py

,並把它裏面的.vim,然後添加以下的.vimrc

設G:ycm_global_ycm_extra_conf = '〜/ vim的/ .ycm_extra_conf.py'

+0

謝謝,現在工作正常! –

+0

如果它解決了您的問題,請標記爲已解決... :) – bagustris