YouCompleteMe自动补全的安装配置与使用
1 下载
git clone --recursive git://github.com/Valloric/YouCompleteMe
如果执行该命令没报错, 就ok了. 但是中途有可能会断掉, 可以 cd 到 YouCompleteMe, 然后反复用如下命令再次进行下载:
git submodule update --init --recursive
又一回我是反复执行了很多次这个命令才下载全了的.
2 安装
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer # 不需要sudo
成功的log如下:
-- [download 99% complete]
-- [download 100% complete]
Using libclang to provide semantic completion for C/C++/ObjC
Using external libclang: /tmp/ycm_build.CKY92s/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04/lib/libclang.so.3.8
-- Found PythonInterp: /usr/bin/python2.7 (found version "2.7.11")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/ycm_build.CKY92s
Scanning dependencies of target BoostParts
[ 0%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/regex_raw_buffer.cpp.o
[ 0%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/regex_debug.cpp.o
[ 1%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/w32_regex_traits.cpp.o
[ 2%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/wide_posix_api.cpp.o
...
[ 80%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/thread/src/pthread/once_atomic.cpp.o
[ 82%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/thread/src/pthread/thread.cpp.o
[ 83%] Linking CXX static library libBoostParts.a
[ 83%] Built target BoostParts
Scanning dependencies of target ycm_core
[ 83%] Building CXX object ycm/CMakeFiles/ycm_core.dir/PythonSupport.cpp.o
[ 84%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Result.cpp.o
[ 85%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Utils.cpp.o
[ 85%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/Documentation.cpp.o
[ 86%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/TranslationUnitStore.cpp.o
[ 88%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/ClangCompleter.cpp.o
[ 88%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/TranslationUnit.cpp.o
[ 88%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/ClangHelpers.cpp.o
[ 89%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/Range.cpp.o
[ 90%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/ClangUtils.cpp.o
[ 91%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/CompletionData.cpp.o
[ 91%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/CompilationDatabase.cpp.o
[ 92%] Building CXX object ycm/CMakeFiles/ycm_core.dir/CandidateRepository.cpp.o
[ 94%] Building CXX object ycm/CMakeFiles/ycm_core.dir/IdentifierDatabase.cpp.o
[ 94%] Building CXX object ycm/CMakeFiles/ycm_core.dir/LetterNode.cpp.o
[ 95%] Building CXX object ycm/CMakeFiles/ycm_core.dir/versioning.cpp.o
[ 95%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Candidate.cpp.o
[ 96%] Building CXX object ycm/CMakeFiles/ycm_core.dir/IdentifierUtils.cpp.o
[ 97%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ycm_core.cpp.o
[ 97%] Building CXX object ycm/CMakeFiles/ycm_core.dir/IdentifierCompleter.cpp.o
[ 98%] Building CXX object ycm/CMakeFiles/ycm_core.dir/LetterNodeListMap.cpp.o
[100%] Building CXX object ycm/CMakeFiles/ycm_core.dir/CustomAssert.cpp.o
[100%] Linking CXX shared library /home/wuyt/mutils/debian_lenny_cfg/vim_cfg/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_core.so
[100%] Built target ycm_core
3 配置
.vimrc中加入:
" YouCompleteMe
set runtimepath+=~/.vim/bundle/YouCompleteMe
let g:ycm_collect_identifiers_from_tags_files = 1 " 开启 YCM 基于标签引擎
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释与字符串中的内容也用于补全
let g:syntastic_ignore_files=[".*\.py$"]
let g:ycm_seed_identifiers_with_syntax = 1 " 语法关键字补全
let g:ycm_complete_in_comments = 1
let g:ycm_confirm_extra_conf = 0
let g:ycm_key_list_select_completion = ['<c-n>', '<Down>'] " 映射按键, 没有这个会拦截掉tab, 导致其他插件的tab不能用.
let g:ycm_key_list_previous_completion = ['<c-p>', '<Up>']
let g:ycm_complete_in_comments = 1 " 在注释输入中也能补全
let g:ycm_complete_in_strings = 1 " 在字符串输入中也能补全
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释和字符串中的文字也会被收入补全
let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
let g:ycm_show_diagnostics_ui = 0 " 禁用语法检查
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" | " 回车即选中当前项
nnoremap <c-j> :YcmCompleter GoToDefinitionElseDeclaration<CR>| " 跳转到定义处
"let g:ycm_min_num_of_chars_for_completion=2 " 从第2个键入字符就开始罗列匹配项
其中 ~/.vim/bundle/YouCompleteMe 为下载 YouCompleteMeu 的路径.
4 使用
- 默认当键入两个字母之后, 则启动补全. 可以通过该变量调整: g:ycm_min_num_of_chars_for_completion
- 也可以使用原有的
<c-x><c-o>
来补全, ycm将其功能增强了. - 按照本文配置, 可用
<c-j>
跳转到定义处. - 默认配置
<TAB>
会选择补全内容, 本文的配置将其屏蔽了, 为了不会与snipmate等需要tab的冲突, 选择补全改为了.
YouCompleteMe自动补全的安装配置与使用的更多相关文章
- EditPlus自动补全、模板配置
EditPlus真的是一款非常好用的编辑器,虽然小,但是短小精悍,速度快.只要配置好了,功能也是很强大的.下面来总结一下如何配置EditPlus的自动补全,和模板配置. 一.配置自动补全:(以开发CS ...
- youcompleteme 自动补全
1. 拷贝配置文件 cp ~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py ~/.vim/.ycm_extra_conf.py 2. 修改配 ...
- 〖Linux〗VIM youcompleteme 自动补全 #include 文件名称
1. 拷贝配置文件 cp ~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py ~/.vim/.ycm_extra_conf.py 2. 修改配 ...
- python学习笔记--导入tab键自动补全功能的配置
今天开始学习Python,必须配置tab键补全功能 1.首先我们需要查看python的安装路径 [root@abc ~]# python Python 2.6.6 (r266:84292, Jan 2 ...
- Python中tab键自动补全功能的配置
新手学习Python的时候,如何没有tab键补全功能,我感觉那将是一个噩梦,对于我们这种菜鸟来说,刚接触python,对一切都不了解,还好有前辈们的指导,学习一下,并记录下来,还没有学习这个功能小伙伴 ...
- ubuntu 14.04 vim YoucompleteMe 代码自动补全工具安装
安装步骤如下: sudo apt-get install vim ; sudo apt-get install vim-youcompleteme ; sudo apt-get install vim ...
- linux-python在vim下的自动补全功能
linux-python在vim下的自动补全功能 安装配置: wget https://github.com/rkulla/pydiction/archive/master.zipunzip -q m ...
- Linux --- vim 安装、支持python3的配置、插件自动补全YCM的安装配置及全过程错误总结
1.git(用来下载vim和相关插件) sudo apt-get install git 2,cmake(用来编译clang-llvm) sudo apt-get install build-esse ...
- CentOS安装oh-my-zsh并配置语法高亮和命令自动补全
安装zsh 和 oh-my-zsh 安装zsh yum install zsh 安装git yum install git 切换默认shell chsh -s /bin/zsh clone from ...
随机推荐
- LeetCode——Implement Queue using Stacks
Description: Implement the following operations of a queue using stacks. push(x) -- Push element x t ...
- UVa 673 Parentheses Balance (stack)
题目描述 : 判断字符串是不是符合正确的表达式形式. 要点 : 考虑字符串为空的时候,用getline输入,每一次判断后如果为No则要清空栈.对称思想. 注意输入格式. 代码: #include &l ...
- Python class的属性访问控制和内建函数重写实现高级功能以及@property
一.类属性的访问控制 Python Class确实是博大精深,我们还是来温习一下属性的访问控制作为开(fu)场(xi). 首先_varname是可以访问的,__varname是不能直接访问(原理是__ ...
- shell 中的()【】{}(())
本文转自:https://blog.csdn.net/taiyang1987912/article/details/39551385 shell中各种括号的作用().(()).[].[[]].{} 一 ...
- 【Android】Android中不同手机分辨率适配问题
在项目开发的过程中,同一个布局对应不同的手机会显示出不同的效果.导致这个现象产生的原因是不同手机的分辨率不同.在android sdk提供的帮助文档中,我们可以看到各种手机的分辨率和对应的屏大小.QV ...
- Unity3D笔记七 GUILayout
一.说到GUILayout就要提到GUI,二者的区别是什么 GUILayout是游戏界面的布局.GUI(界面)和GUILayout(界面布局)功能上面是相似的从命名中就可以看到这两个东西非常相像,但是 ...
- postgresql数据库创建、修改、删除
一.数据库创建 语法: Command: CREATE DATABASEDescription: create a new databaseSyntax:CREATE DATABASE nam ...
- javascript飞机大战-----004创建子弹对象
/* 创建子弹:因为子弹不是只创建一个所以要用构造函数 注意一点:子弹发射的位置应该是英雄机的正中央的位置,所以需要传点东西进来 */ function Bullet(l,t){ this.l = l ...
- Jenkins升级、迁移、备份
1.升级 下载新版Jenkins.war文件,替换旧版本war文件,重启即可. Jenkins.war文件的位置一般为/usr/lib/jenkins/Jenkins.war. 2.迁移.备份 Jen ...
- mybatis-spring-boot-autoconfigure
mybatis-spring-boot-autoconfigure – MyBatis Sring-BootStarter | Reference Documentation http://www.m ...