采用ycmd模式 加上 前面介绍的company-mode
参考,重点内容已经截出来
[Clients commonly build and set up ycmd for you; you are unlikely to need tobuild ycmd yourself unless you want to build a new client.]
This is all for Ubuntu Linux. Details on getting ycmd running on other OS‘s can befound in YCM‘s instructions (ignore the Vim-specific parts).
First, install the dependencies:
sudo apt-get install build-essential cmake python-dev
When you first clone the repository you‘ll need to update the submodules:
git submodule update --init --recursive
Then run ./build.py --clang-completer --omnisharp-completer --gocode-completer
.This should get you going.
For more detailed instructions on building ycmd, see YCM‘sinstructions (ignore the Vim-specific parts).
编译好后,会出现一个在ycmd目录下出现一个同名的ycmd目录。这个路径等会需要。
这个不再细说。
;; company mode (add-hook ‘c++-mode-hook ‘global-company-mode) ;; ycmd (require ‘ycmd) (add-hook ‘c++-mode-hook ‘ycmd-mode) (set-variable ‘ycmd-server-command ‘("python" "/home/dean/work/software/ycmd/ycmd")) (set-variable ‘ycmd-extra-conf-whitelist ‘("/home/dean/work/gitlab/gitlab.com/cppwizard/console/*")) (require ‘company-ycmd) (company-ycmd-setup)
文件可以从ycmd的example目录中复制出来,名为.ycm_extra_conf.py,放在这里
/home/dean/work/gitlab/gitlab.com/cppwizard/console/*
flags = [ ‘-Wall‘, ‘-Wextra‘, ‘-Werror‘, ‘-fexceptions‘, ‘-DNDEBUG‘, # THIS IS IMPORTANT! Without a "-std=<something>" flag, clang won‘t know which # language to use when compiling headers. So it will guess. Badly. So C++ # headers will be compiled as C headers. You don‘t want that so ALWAYS specify # a "-std=<something>". # For a C project, you would set this to something like ‘c99‘ instead of # ‘c++11‘. ‘-std=c++11‘, # ...and the same thing goes for the magic -x option which specifies the # language that the files to be compiled are written in. This is mostly # relevant for c++ headers. # For a C project, you would set this to ‘c‘ instead of ‘c++‘. ‘-x‘, ‘c++‘, ‘-isystem‘, ‘/usr/include‘, ‘-isystem‘, ‘/usr/local/include‘, ‘-isystem‘, ‘/home/dean/work/gitlab/gitlab.com/cppwizard/console/include‘ ]
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/csfreebird/article/details/48898801