作者ptkt (阿呆)
看板Editor
标题Re: [vim ] YouCompleteMe 写C++自动补全问题
时间Thu May 7 08:22:16 2015
※ 引述《BCRK7 (K7)》之铭言:
: 最近在设定Vim的Plugin,
: 我想用它来写C++程式,於是安装了YouCompleteMe这个Plugin。
: 但我发现我不懂怎麽写.ycm_extra_conf.py,於是就用别人写好的。
: 但我想要include <iostream> ,
: 我希望我输入 #include <i 时,他会有个 <iostream> 的选项让我选。
: 结果他出来的选项都是一些不重要的东西。
: http://imgur.com/a1cb90T
: 请问有办法让他侦测我的library吗?
: 我的.ycm_extra_conf.py
: https://github.com/Kai7/.vim/blob/master/.ycm_extra_conf.py
: 另外,我在看YouCompleteMe的文件时,有句话我不懂他的意思。
: YCM looks for a .ycm_extra_conf.py file in the directory of the opened file or in any directory above it in the hierarchy (recursively)
: 我把他理解成,假设我在 /home/user/cpp/ 底下写 hello.cpp 时,他会先找 /home/user/cpp/ 底下有没有.ycm_extra_conf.py,
: 没有的话再往上找 /home/user ... 以此类推。
如果您写的project很大的话, YouCompleteMe有支援 Clang's Compil
ationDatabase system, 可以在.ycm_extra_conf.py file里面设定compil
e_commands.json file的路径, 至於要如何产生compile_commands.json,
要看您project使用的build system, 如果是用CMake,那麽在在build的时候
可以加上-DCMAKE_EXPORT_COMPILE_COMMANDS=ON这个参数来产生, 如果是用
其它build system, 则可以使用Bear(
https://github.com/rizsotto/Bear)
这个工具来产生, 要是您不想用compile_commands.json, 也有YCM-Genera
tor(
https://github.com/rdnetto/YCM-Generator)这个工具来帮您自动产
生.ycm_extra_conf.py.
以上说的这些在YouCompleteMe的github里的README.md也有提到, 有不
清楚的地方可以去上面看一下.
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 59.120.66.85
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Editor/M.1430958141.A.76E.html
※ 编辑: ptkt (59.120.66.85), 05/07/2015 08:30:13
※ 编辑: ptkt (59.120.66.85), 05/07/2015 08:56:42
※ 编辑: ptkt (59.120.66.85), 05/07/2015 09:02:01
※ 编辑: ptkt (59.120.66.85), 05/07/2015 09:08:28
※ 编辑: ptkt (59.120.66.85), 05/07/2015 09:10:52
1F:推 Arton0306: 推bear 好用! 05/11 00:11