Ubuntu 搭建强大的 IDE —— Vim + Vundle + 插件(下)
|
在上一节(http://www.voidcn.com/article/p-vjtzfhwe-bqm.html)我们已经通过 Vundle 下载、安装了一些插件,这些插件有一些可以直接用、有一些需要配置、有一些则需要编译,下面我们一一来看一下常用的一些插件应该怎样用起来吧。 首先要讲的是 YouCompleteMe,它应该是最难安装的一个插件了。vundle 已经帮我们做了一部分工作,但还不能使它正常工作起来,对于 C/C++ 用户来说,我们还需要编译 ycm_core.so 和 libclang.so。编译方法如下: $ cd ~/.vim/bundle/YouCompleteMe $ ./install.sh --clang-completer WARNING: this script is deprecated. Use the install.py script instead. ERROR: please install CMake and retry. $ ./install.py --clang-completer ERROR: please install CMake and retry. YouCompleteMe 目录下有两个安装脚本,install.sh 和 install.py,显然根据执行情况来看,install.sh 已经失效了,最后执行的是 install.py。但是,需要 CMake 的支持! $ sudo apt-get install cmake 很可惜,对于 Ubuntu 12.04 的用户来说,这种方法并不行。因为 install.py 要求的 CMake 需要 2.8.11 以上版本。所以我们还是手动安装一下吧: $ wget http://www.cmake.org/files/v2.8/cmake-2.8.12.1-Linux-i386.tar.gz $ tar zxvf cmake-2.8.12.1-Linux-i386.tar.gz $ cd cmake-2.8.12.1-Linux-i386 $ sudo cp bin/* /usr/bin/ $ sudo cp -r share/cmake-2.8 /usr/share/ 好了,现在可以继续执行 $ ./install.py --clang-completer Searching Python 2.7 libraries... Found Python library: /usr/lib/python2.7/config/libpython2.7.so Found Python headers folder: /usr/include/python2.7 -- The C compiler identification is GNU 4.6.3 -- The CXX compiler identification is GNU 4.6.3 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done CMake Error at CMakeLists.txt:217 (message): Your C++ compiler does NOT fully support C++11. ...... 显然,这次是由于 C++ 编译器不完全支持 C++ 11 造成的,因为 g++ 4.8 以上版本才完全支持 C++11 啊!而 Ubuntu 12.04 中用 apt-get 安装的是 4.6 版本的,所以还是手动升级一下 gcc 和 g++ 吧。具体方法参考:http://www.linuxidc.com/Linux/2014-03/97445.htm。 ...... g++: internal compiler error: Killed (program cc1plus) Please submit a full bug report, 经检查发现是因为我的虚拟机内存不足呀,编译 Linux 都没问题,没想到编译这个会出问题。。。好吧,面对这个情况,我们可以加大虚拟机的内存分配,或者临时使用交换分区来解决! $ cd ~/.vim/bundle/YouCompleteMe/third_party/ycmd/ $ ls *.so* libclang.so.4 libclang.so.4.0 ycm_core.so 还差一步,运行 vim 的时候我们发现缺少 .ycm_extra_conf.py 文件。那就拷贝一份吧: $ cd ~/.vim/bundle/YouCompleteMe/ $ cp ./third_party/ycmd/examples/.ycm_extra_conf.py ~/.vim/ 然后在 ~/.vimrc 中添加如下配置: let g:ycm_server_python_interpreter='/usr/bin/python' let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py' 好了,打开 vim 试一下呗! 搞定 YouCompleteMe 就完成了一大步了,其他插件的用法都比较简单,我在这里就大概列一下插件及其作用吧。(注意:有些插件存在包含与被包含的关系,有些插件功能相似,因此选择其中的一些使用即可。)
(编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
