c – YouCompleteMe无法自动完成

我想开发C/C++程序,所以我通过Vundle为Vim安装了YouCompleteMe.但它无法正常工作,实际上,它只显示当前file.hope中包含的单词来帮助!
我的步骤如下:

>下载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和clang llvm


    http://llvm.org/releases/download.html#3.6.0
    
Download

>准备clang和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
最佳答案
使用快捷键Ctrl-X Ctrl-O进行检查以进行全向完成(功能).

它将触发全向功能,

和/或从以下链接下载.ycm_extra_conf.py>> https://github.com/rasendubi/dotfiles/blob/d534c5fb6bf39f0d9c8668b564ab68b6e3a3eb78/.vim/.ycm_extra_conf.py

并将其放在.vim中,然后将以下内容添加到.vimrc中

let g:ycm_global_ycm_extra_conf = ‘~/.vim/.ycm_extra_conf.py’

相关文章

linux常用进程通信方式包括管道(pipe)、有名管道(FIFO)、...
Linux性能观测工具按类别可分为系统级别和进程级别,系统级别...
本文详细介绍了curl命令基础和高级用法,包括跳过https的证书...
本文包含作者工作中常用到的一些命令,用于诊断网络、磁盘占满...
linux的平均负载表示运行态和就绪态及不可中断状态(正在io)的...
CPU上下文频繁切换会导致系统性能下降,切换分为进程切换、线...