说说Mac安装YCM

说说Mac安装YCM

首先我们得安装brew,安装brew的目的是为了安装cmake!

1.安装brew和cmake

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

check:

brew doctor


          然后安装:brew install cmake


2.接下来是clang和llvm,同样采取的是网站上面已经编译好的二进制代码:

下载:Clang for Darwin 10.9     同样在这里也可以下载:http://llvm.org/releases/download.html#3.3

将这个包解压,并且重命名为:clang_llvm

###这里不需要像ubutnu那样还要下载python-dev,Mac自带有###


3.准备工作完成,开始编译和安装

  git clone https://github.com/gmarik/vundle.git  ~/.vim/bundle/vundle

####为了增大成功的概率,最好是进入~/.vim/bundle/vundle,获取最新的git仓库

输入命令:git submodule update --init --recursive

 这样即使有什么更新,也能及时搞定

然后把如下信息添加到/.vimrc,如果没有那么新建一个

命令(假设没有):

touch ~/.vimrc

vim .vimrc

添加的信息:

set nocompatible              " be iMproved

set nu

set noswapfile

syntax on

set backspace=2

set tabstop=4

set shiftwidth=4

set completeopt=menu

:colorscheme ron

set cindent

set rtp+=~/.vim/bundle/vundle/

call vundle#rc()

Bundle 'gmarik/vundle'

Bundle 'Valloric/YouCompleteMe'  

Bundle 'scrooloose/syntastic'

Bundle 'jiangmiao/auto-pairs'

""""""""""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++'

"set error or warning signs

let g:syntastic_error_symbol = 'x'

let g:syntastic_warning_symbol = '!'

"whether to show balloons

let g:syntastic_enable_balloons = 1



""""""""""""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

filetype plugin indent on

随便打开一个vim窗口

输入:

   :BundleInstall  


cd ~

mkdir ycm_build

cd ycm_build



运行:

cmake -G "Unix Makefiles" -DPATH_TO_LLVM_ROOT=~/clang_llvm . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp


接下来:

make ycm_support_libs



  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值