yangyangwithgnu / use_vim_as_ide

use vim as IDE
Creative Commons Zero v1.0 Universal
9.23k stars 2.38k forks source link

除了补全之外,同时列出可供选择的函数原型或者类,更好吧 #61

Open wayd2001 opened 7 years ago

wayd2001 commented 7 years ago

各位,我花了几天的时间研究了一下ycm的配置,操作系统为fedora24,我主要是用于编写linux下面的c程序,我的配置过程如下: 1、dnf install vim python-devel python3-devel boost-devel cmake gcc-c++ ctags

2、下载.vimrc及.ycm_extra_conf.py,使用bundle安装插件

3、下载clang+llvm-3.9.0-x86_64-fedora23.tar.xz

4、 cd downloads/ mkdir ycm_build cd ycm_build cmake -G "Unix Makefiles" -DUSE_SYSTEM_BOOST=ON -DPATH_TO_LLVM_ROOT=~/downloads/clang+llvm/ .\ ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp cmake --build . --target ycm_core 安装完成后有ycm_core.so、libclang.so ,无ycm_client_support.so,查看ycm的官方说明,目前ycm_client_support.so不是必须的了。

5、.vimrc中加入“ let g:ycm_global_ycm_extra_conf='/home/sdt/.ycm_extra_conf.py'”

6、配置完成后,启动vim,执行:ycmdebuginfo,提示如下

Printing YouCompleteMe debug information... -- Server has Clang support compiled in: True -- Clang version: clang version 3.9.0 (tags/RELEASE_390/final) -- C-family completer debug information: -- Configuration file found and loaded -- Configuration path: /home/sdt/.ycm_extra_conf.py -- Flags: ['-std=c++11', '-O0', '-Werror', '-Weverything', '-Wno-documentation', '-Wno-deprecated-declarations', '-Wno-disabled-macro-expansion', '-Wno-float-equal', '-Wno-c++98-compat', '-Wno-c++98-compat-pedantic', '-Wno-globa l-constructors', '-Wno-exit-time-destructors', '-Wno-missing-prototypes', '-Wno-padded', '-Wno-old-style-cast', '-W no-weak-vtables', '-x', 'c++', '-I', '/home/sdt/.', '-isystem', '/usr/include/', '-resource-dir=/home/sdt/.vim/bund le/YouCompleteMe/third_party/ycmd/ycmd/../clang_includes', '-fspell-checking'] -- Server running at: http://127.0.0.1:47190 -- Server process ID: 8166 -- Server logfiles: -- /tmp/ycmd_47190_stdout_2uhaw_11.log -- /tmp/ycmd_47190_stderr_r2g15550.log 应该算是配置成功了。

我觉得可能有点问题,并且希望增加功能两个地方是: 1、 现象:我在书写函数或者类名时,需要使用C-X C-O快捷键才会提示,而不是在我输入几个字母后自动提示。比如我输入pthread_之后,按C-X C-O,才会提示线程相关函数。结构体也是如此。 问题:是否我的配置还有遗漏和缺失的地方呢? 希望:是否可以将提示功能更加完善,再输入函数前几个字母的时候,便可以自动弹出提示函数、结构体、变量等。

2、 现象:在我补全完函数,输入(后,函数提示便消失了,再次按C-X C-O也未出现。这样会导致我第一次执行C-X C-O时,我需要记住函数里的参数,否则便无法再进行提示了。 11 问题:如上所说,输入(后,无法提示函数参数了。 希望:是否可以改进此功能,或者也是我的配置出现问题。如果配置正确的话,是否可以一直有函数参数的提示功能,并且如果可以出现在下方状态栏的话,更为方便。

3、如果我希望补全系统函数,是否还需要在/usr/include下使用ctags生成tags文件呢?并且是否要使用set tags+=方式引入到vimrc中呢?

4、目前.ycm_extra_conf.py使用的是github中提供的,里面多是c++配置选项,如果是用于c编写,是否可以有参考的样例呢?如果是个人的一些工程,比如opensll的项目,是否要将对应的include目录以如下方式写入.ycm_extra_conf.py? '-isystem', '/openssl/include/', 是否可以收集一些关于java,js,python等相关的配置文件的收集呢?

5、另外,对于代码提示时的背景颜色和字体颜色,在哪里设置呢?

6、另外,我在书写程序时,在结构体,函数名称后面会有如下奇怪的东西。 2016-11-22 10 00 43 "zc_pro"后面的[id]是什么东西?按下C-X C-O才会有函数提示。

谢谢大家!