【转】ubuntu 12.04 下 Vim 插件 YouCompleteMe 的安装
原文网址:http://www.cnblogs.com/jostree/p/4137402.html
作者:jostree 转载请注明出处 http://www.cnblogs.com/jostree/p/4137402.html
1.需要保证vim的版本大于7.3.584,否则的话需要更新vim
可以通过第三方源更新:
在终端输入下面的代码:
$ sudo add-apt-repository ppa:fcwu-tw/ppa
$ sudo apt-get update
$ sudo apt-get install vim
升级得到vim7.4
2.需要有clang3.2以上的库
可以再此处下载:http://llvm.org/releases/download.html
可以下载已经变编译好的clang3.4,并注意操作系统版本
3.安装vundle插件
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
并配置.vimrc
set nocompatible "与vi不一致
filetype off
set rtp+=~/.vim/bundle/vundle/ "载入特定目录插件
"set rtp+=$HOME/.vim/bundle/vundle/ "Windows下
call vundle#rc()
"plugin
"vimscripts账号下的项目直接填写名称即可
Bundle 'snipMate'
"其它需填写用户/资源名称
Bundle 'gmarik/vundle'
"非github上资源
Bundle 'git://git.wincent.com/command-t.git'
"indent
Bundle 'php.vim-html-enhanced'
"color
Bundle 'Lucius'
filetype plugin indent on
4.利用vundle插件安装YouCompleteMe和syntastic插件:
在.vimrc中添加
Bundle 'https://github.com/Valloric/YouCompleteMe.git'
Bundle 'https://github.com/scrooloose/syntastic.git'
然后在vim中执行:Vundle Install!
即可安装好这两个插件,安装YouCompleteMe的过程很漫长
可以直接在~/.vim/bundle/目录下,执行:
sudo git clone https://github.com/Valloric/YouCompleteMe.git
sudo git submodule update --init --recursive
也可以得到同样的效果。其中第二行是递归的更新子文件夹的内容。
5.编译YouCompleteMe插件
首先需要安装CMAKE
sudo apt-get install cmake
然后在家目录下建立一个ycm_build文件夹
cd ~
mkdir ycm_build
cd ycm_build
然后cmke使用cmake命令生成makefile文件:
cmake -G "Unix Makefiles" -DPATH_TO_LLVM_ROOT=~/ycm_temp/llvm_root_dir . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
此处需要注意的是需要修改DPATH_TO_LLVM_ROOT=~/ycm_temp/llvm_root_dir,令其等于clang3.4的路径。
然后make编译
make ycm_support_libs
即可生成编译后的库文件。
最后回到YouCompleteMe目录下:
执行
cd ~/.vim/bundle/YouCompleteMe
./install.sh --clang-completer --system-clang
即可完成。
6.配置自动补全python脚本:
在~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/路径下的.ycm_extra_conf.py文件中
删除.ycm_extra_conf.py中的
# NOTE: This is just for YouCompleteMe; it's highly likely that your project
# does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR
# ycm_extra_conf IF YOU'RE NOT 100% YOU NEED IT.
try:
final_flags.remove( '-stdlib=libc++' )
except ValueError:
pass
将之删除后YCM才会补全c++标准库的内容。
并添加
'/usr/include',
'-isystem',
'/usr/include/c++/'
到flags列表中使其可以补C++库中的头文件。
7.最终更改~/.vimrc的配置文件:
set nocompatible " be iMproved
filetype off " required! set rtp+=~/.vim/bundle/vundle/
call vundle#rc() " let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle' " My Bundles here:
"
" original repos on github Bundle 'tpope/vim-fugitive'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
Bundle 'tpope/vim-rails.git'
" vim-scripts repos
Bundle 'L9'
Bundle 'FuzzyFinder'
" non github repos
Bundle 'git://git.wincent.com/command-t.git'
" My plugin
Bundle 'perl-support.vim'
Bundle 'ctags.vim'
Bundle 'taglist.vim'
Bundle 'https://github.com/Lokaltog/vim-powerline.git'
Bundle 'LaTeX-Suite-aka-Vim-LaTeX'
Bundle 'Simple-R-Omni-Completion'
"Bundle 'Pydiction'
Bundle 'The-NERD-tree'
Bundle 'Tagbar'
Bundle 'asins/vimcdoc'
Bundle 'cpp.vim'
Bundle 'c.vim'
Bundle 'code_complete'
Bundle 'autoproto.vim'
Bundle 'a.vim'
Bundle 'pyflakes.vim'
Bundle 'Conque-Shell'
Bundle 'python.vim'
Bundle 'multvals.vim'
Bundle 'gdbvim'
Bundle 'glib.vim'
Bundle 'VimIM'
Bundle 'OmniCppComplete'
Bundle 'echofunc.vim'
"Bundle 'clang-complete'
"Bundle 'pythoncomplete'
Bundle 'minibufexpl.vim'
Bundle 'https://github.com/Valloric/YouCompleteMe.git'
Bundle 'https://github.com/scrooloose/syntastic.git'
"Bundle 'https://github.com/Valloric/ListToggle.git' "Bundle 'Valloric/YouCompleteMe' "Bundle 'qiushibaike'
filetype plugin indent on " required! "
" Brief help -- 此处后面都是vundle的使用命令
" :BundleList - list configured bundles
" :BundleInstall(!) - install(update) bundles
" :BundleSearch(!) foo - search(or refresh cache first) for foo
" :BundleClean(!) - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle command are not allowed..
"
" set nocompatible "去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限
set showmatch
set matchtime=1
set autowrite
set ruler " 打开状态栏标尺
set cursorline " 突出显示当前行
nnoremap <F2> :g/^\s*$/d<CR>
set laststatus=1 "启动显示状态行(1),总是显示状态行(2)
set foldenable " 允许折叠
"set foldmethod=indent " 手动折叠
set nu
set fileencodings=utf-8,ucd-bom,gb18030,gbk,gb2312,cp936
set tabstop=4
set sts=4
set expandtab
set softtabstop=4
set shiftwidth=4
set autoindent
set cindent
set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s
colorscheme desert
set nobackup
set textwidth=100
map <F5> :! /usr/bin/python %
map <F6> :call CompileRunGpp()<CR> """"""""""syntastic""""""""""""
let g:syntastic_check_on_open = 1
let g:syntastic_cpp_include_dirs = ['/usr/include/']
let g:syntastic_cpp_remove_include_errors = 1
let g:syntastic_cpp_check_header = 1
let g:syntastic_cpp_compiler = 'clang++'
let g:syntastic_cpp_compiler_options = '-std=c++11 -stdlib=libstdc++'
"set error or warning signs
let g:syntastic_error_symbol = "✗"
let g:syntastic_warning_symbol = "⚠"
"whether to show balloons
let g:syntastic_enable_balloons = 1
let g:syntastic_always_populate_loc_list = 1 nnoremap <silent> <C-d> :lclose<CR>:bdelete<CR>
cabbrev <silent> bd lclose\|bdelete """"""""""""YCM""""""""""""""""""""
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
let g:ycm_collect_identifiers_from_tags_files = 1
let g:ycm_seed_identifiers_with_syntax = 1
let g:ycm_confirm_extra_conf = 0
let g:ycm_always_populate_location_list = 1
let g:ycm_min_num_of_chars_for_completion = 2
let g:ycm_complete_in_comments = 1 nnoremap <leader>jd :YcmCompleter GoToDefinitionElseDeclaration<CR>
nnoremap <leader>lo :lopen<CR> "minibufexpl
"{
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplMapWindowNavVim = 1
"}
"
"pydiction
"{
"filetype plugin on
"let g:pydiction_location='~/.vim/bundle/Pydiction/complete-dict'
"}
"" OmniCppComplete
"" {
" "-- omnicppcomplete setting --
" " 按下F3自动补全代码,注意该映射语句后不能有其他字符,包括tab;否则按下F3会自动补全一些乱码
" imap <F3> <C-X><C-O>
" " 按下F2根据头文件内关键字补全
" imap <F2> <C-X><C-I>
" set completeopt=menu,menuone " 关掉智能补全时的预览窗口
" let OmniCpp_MayCompleteDot = 1 " autocomplete with .
" let OmniCpp_MayCompleteArrow = 1 " autocomplete with ->
" let OmniCpp_MayCompleteScope = 1 " autocomplete with ::
" let OmniCpp_SelectFirstItem = 2 " select first item (but don't insert)
" let OmniCpp_NamespaceSearch = 2 " search namespaces in this and included files
" let OmniCpp_ShowPrototypeInAbbr = 1 " show function prototype in popup window
" let OmniCpp_GlobalScopeSearch=1 " enable the global scope search
" let OmniCpp_DisplayMode=1 " Class scope completion mode: always show all members
"let OmniCpp_DefaultNamespaces=["std"]
" let OmniCpp_ShowScopeInAbbr=1 " show scope in abbreviation and remove the last column
" let OmniCpp_ShowAccess=1
" set tags+=/usr/include/c++/tags "need to ctags -R --c++-kinds=+p --fields=+iaS --extra=+q
" }
" echofunc.vim
" {
" }
"vimIM
"{
let g:vimim_cloud='sogou'
let g:vimim_map='tab_as_onekey'
let g:vimim_map='no-gi'
let g:vimim_map_extra='ctrl_h_as_ctrl_bslash'
"let g:vimim_static_input_style=1
let g:vimim_toggle = 'pinyin,sogou,baidu'
let g:vimim_plugin = '/home/liuyi/.vim/bundle/VimIM/plugin'
"}
"
"" Bundle 'clang-complete'
"" {
"let g:clang_auto_select = 1
"let g:clang_complete_copen=1
"let g:clang_periodic_quickfix=1
"let g:clang_snippets=1
"let g:clang_snippets_engine = 'clang_complete'
"let g:clang_close_preview=1
"let g:clang_use_library=1
"let g:clang_user_options='-stdlib=libc++ -std=c++11 -IIncludePath'
"let g:neocomplcache_enable_at_startup = 1
"" }
"pyflakes python语法分析
"{
"filetype plugin indent on
"}
"python_complete
"{
set ofu=syntaxcomplete
autocmd FileType python
set omnifunc=pythoncomplete
"autocmd FileType python runtime! autoload/pythoncomplete.vim
"}
"
"tagbar
"{
"nmap <Leader>tb :TagbarToggle<CR>
map <F8> :TagbarToggle<CR>
imap <F8> <ESC>:NERDTreeToggle<CR>
let g:tagbar_ctags_bin='/usr/bin/ctags'
let g:tagbar_width=30
autocmd BufReadPost *.cpp, *.c, *.h, *.hpp, *.cc, *.cxx call tagbar#autoopen()
"} "omni-completion
"{
"autocmd FileType python set omnifunc=pythoncomplete#Complete
"let g:pydiction_location='~/.vim/bundle/Pydiction/complete-dict'
filetype plugin on
"} "taglist
"{
let Tlist_Auto_Highlight_Tag=1
"let Tlist_Auto_Open=1
let Tlist_Auto_Update=1
let Tlist_Display_Tag_Scope=1
let Tlist_Exit_OnlyWindow=1
let Tlist_Enable_Dold_Column=1
"let Tlist_File_Fold_Auto_Close=1
let Tlist_Show_One_File=1
let Tlist_Use_Right_Window=1
let Tlist_Use_SingleClick=1
"nnoremap <Leader>tl :TlistToggle<CR>
"设定F8为taglist开关
"} "Nerd-tree
"{
map <F7> :NERDTreeToggle<CR>
imap <F7> <ESC>:NERDTreeToggle<CR>
"} "WinManager
"{
let g:winManagerWindowLayout='FileExplorer|BufExplorer' " 这里可以设置 为多个窗口, 如'FileExplorer|BufExplorer|TagList'
let g:persistentBehaviour=0 " 只剩一个窗口时, 退出vim.
let g:winManagerWidth=20
let g:defaultExplorer=1
nmap <leader>fir :FirstExplorerWindow<cr>
nmap <leader>bot :BottomExplorerWindow<cr>
nmap <leader>wm :WMToggle<cr>
"}
"
runtime! ftplugin/man.vim set hlsearch
set autoindent " copy indent from current line
set autoread " read open files again when changed outside Vim
set autowrite " write a modified buffer on each :next , ...
set backspace=indent,eol,start " backspacing over everything in insert mode
"set backup " keep a backup file
set browsedir=current " which directory to use for the file browser
set complete+=k " scan the files given with the 'dictionary' option
set history=50 " keep 50 lines of command line history
set hlsearch " highlightthe last used search pattern
set incsearch " do incremental searching
set listchars=tab:>.,eol:\$ " strings to use in 'list' mode
set mouse=a " enable the use of the mouse
set wrap " wrap lines
set popt=left:8pc,right:3pc " print options
set ruler " show the cursor position all the time
"set shiftwidth=2 " number of spaces to use for each step of indent
set showcmd " display incomplete commands
set smartindent " smart autoindenting when starting a new line
"set tabstop=2 " number of spaces that a <Tab> counts for
set visualbell " visual bell instead of beeping
set wildignore=*.bak,*.o,*.e,*~ " wildmenu: ignore these extensions
set wildmenu " command-line completion in an enhanced mode
set formatoptions=tcrqn
"
"-------------------------------------------------------------------------------
" highlight paired brackets
"-------------------------------------------------------------------------------
highlight MatchParen ctermbg=blue guibg=lightyellow inoremap , ,<Space>
"
"-------------------------------------------------------------------------------
" autocomplete parenthesis, (brackets) and braces
"-------------------------------------------------------------------------------
inoremap ( ()<Left>
inoremap [ []<Left>
inoremap { {}<Left>
"
vnoremap ( s()<Esc>P<Right>%
vnoremap [ s[]<Esc>P<Right>%
vnoremap { s{}<Esc>P<Right>%
"
" surround content with additional spaces
"
vnoremap ) s( )<Esc><Left>P<Right><Right>%
vnoremap ] s[ ]<Esc><Left>P<Right><Right>%
vnoremap } s{ }<Esc><Left>P<Right><Right>%
set vb t_vb="
" vim-powerline
set laststatus=2
set t_Co=256
let g:Powerline_symbols = 'unicode'
set encoding=utf8 "vimcdoc
"{
set helplang=cn
"} "shift tab page
"{
map <S-Left> :tabp<CR>
map <S-Right> :tabn<CR>
"}
【转】ubuntu 12.04 下 Vim 插件 YouCompleteMe 的安装的更多相关文章
- ubuntu 12.04 下 Vim 插件 YouCompleteMe 的安装
作者:jostree 转载请注明出处 http://www.cnblogs.com/jostree/p/4137402.html 1.需要保证vim的版本大于7.3.584,否则的话需要更新vim 可 ...
- 在Ubuntu 12.04下采用apt-get的方法安装Qt4
在Ubuntu 12.04下采用apt-get的方法安装Qt4 注:之前发表的一篇博客是采用编译源码的方式安装Qt4,这是很有用的方式,因为源码安装对于所有系统都是通用的,其次,在使用交叉编译器的时候 ...
- ubuntu 12.04下安装Qt出现cannot execute binary file的解决方案
最近在ubuntu 12.04下安装QT的过程中,遇到一个问题. ./qt-opensource-linux-x64-5.7.0.run出现了bash: ./qt-opensource-linux-x ...
- Ubuntu 12.04下Hadoop 2.2.0 集群搭建(原创)
现在大家可以跟我一起来实现Ubuntu 12.04下Hadoop 2.2.0 集群搭建,在这里我使用了两台服务器,一台作为master即namenode主机,另一台作为slave即datanode主机 ...
- Ubuntu 12.04下GAMIT10.40安装说明
转载于:http://www.itxuexiwang.com/a/liunxjishu/2016/0225/164.html?1456481297 Ubuntu 12.04下GAMIT10.40安装步 ...
- Angularjs学习---angularjs环境搭建,ubuntu 12.04下安装nodejs、npm和karma
1.下载angularjs 进入其官网下载:https://angularjs.org/,建议下载最新版的:https://ajax.googleapis.com/ajax/libs/angular ...
- [转]ubuntu(12.04)下, 命令 ,内核 源代码的获取
[转]ubuntu(12.04)下, 命令 ,内核 源代码的获取 http://blog.chinaunix.net/uid-18905703-id-3446099.html 1.命令:例如:要查看l ...
- Ubuntu 12.04 下安装 Eclipse
方法一:(缺点是安装时附加openjdk等大量程序并无法去除,优点是安装简单) $ sudo apt-get install eclipse 方法二:(优点是安装内容清爽,缺点是配置麻烦)1.安装JD ...
- 在Ubuntu 12.04下编译qtiplot
不在windows下,再加上不想用盗版,所以需要一个origin的替代品——qtiplot.虽然我非常抵抗用这种不停点来点去的软件,用R的ggplot2画图多好啊,高效.优雅.漂亮,但是终抵不过老板一 ...
随机推荐
- Labeled Faces in the Wild 人脸识别数据集
http://blog.csdn.net/garfielder007/article/details/51480525 New (draft) survey paper: Labeled Faces ...
- vs+qt使用资源文件
1.在Resources目录新建一个.qrc文件 2.在解决方案的Resource Files中添加这个文件 3.为这个qrc添加资源,建议把资源都放进Resources
- ThinkPHP开发博客系统笔记之一
1.前后台搭建 开发的第一步是搭建前后台系统.搭建前台系统的时候新建了LoginController控制器和登录界面View/Login/index.tpl.模板文件中需要引入js和css文件,这里想 ...
- Matlab绘图基础——利用axes(坐标系图形对象)绘制重叠图像 及 一图多轴(一幅图绘制多个坐标轴)
描述 axes在当前窗口中创建一个包含默认属性坐标系 axes('PropertyName',propertyvalue,...)创建坐标系时,同时指定它的一些属性,没有指定的使用DefaultAxe ...
- 【异常记录(六)】vs文件乱码:文件加载,使用Unicode(UTF-8)编码加载文件xxx时,有些字节已用Unicode替换字符替换。保存该文件将不会保留原始文件内容。
VS2013偶遇这种情况,页面汉字编码出现乱码. .... 按照网上查到的: 工具>选项>文本编辑器> 勾选了 然并卵,还是乱码... 其实炒鸡简单 用记事本打开另存为,选择 ...
- 七步精通Python机器学习--转载
作者简介: Matthew Mayo 翻译:王鹏宇 开始.这是最容易令人丧失斗志的两个字.迈出第一步通常最艰难.当可以选择的方向太多时,就更让人两腿发软了. 从哪里开始? 本文旨在通过七个步骤, ...
- mysql explain extended 查看 执行计划
本文以转移至本人的个人博客,请多多关注! 本文以转移至本人的个人博客,请多多关注! 本文以转移至本人的个人博客,请多多关注! 本文以转移至本人的个人博客,请多多关注! 1. explain 可以查看 ...
- HIVE之常用字符串函数
可以参考: 博文 : https://www.iteblog.com/archives/1639.html
- jstack工具介绍
一.使用场景 当一个java应用CPU的使用比较高或者到达100%以上的时候,需要分析代码哪里有问题.这时候可以使用jstack命令 二.怎么使用 先使用命令ps –ef |grep keyword ...
- app手机端连接tomcat电脑端服务器
1.你要在电脑端开启并启动tomcat 2.启动nginx,然后需要在nginx中配置好端口号,每一个app的模块端口号是不一样的,需要你进行更改 3.如下图代表app连接的端口: 4.关于sql过滤 ...