关键字: HomeBrew,好比Windows下的Cygwin
安装Homebrew
该si胜过macport
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
说明:程序在/usr/local/Library/下。以后软件包下载到/Library/Caches/Homebrew下,安装在路径/usr/local/Cellar下,并自动链接到/usr/local下各个子目录中
安装macvim
brew install macvim
配置
mac os x本身有一套vim、python、ctags之类,需要屏蔽。设置命令行下brew独立的环境变量
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin说明:该语句填入~/.bashrc文件是沒有用的,必须在命令行终端下输入或 source ~/.bashrc
升级 新版vim用于安装vim 自动补全插件
brew install vim
安装vundle管理vim插件
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/
编写.vimrc配置vundle以安装插件
"设置vundleset nocompatible " be iMprovedfiletype off " required!" set the runtime path to include Vundle and initializeset rtp+=~/.vim/bundle/Vundle.vimcall vundle#begin()" alternatively, pass a path where Vundle should install plugins"call vundle#begin('~/some/path/here')" let Vundle manage Vundle, requiredPlugin 'gmarik/Vundle.vim'" The following are examples of different formats supported." Keep Plugin commands between vundle#begin/end." plugin on GitHub repoPlugin 'tpope/vim-fugitive'" plugin from http://vim-scripts.org/vim/scripts.htmlPlugin 'L9'" Git plugin not hosted on GitHub"Plugin 'git://git.wincent.com/command-t.git'Plugin 'scrooloose/nerdtree' "文件浏览Plugin 'majutsushi/tagbar' "代码符号Plugin 'wesleyche/SrcExpl' "类似sourceInsight的代码预览窗口Plugin 'Valloric/YouCompleteMe' "自动补全Plugin 'vim-scripts/a.vim' "在头文件、源文件之间切换Plugin 'flazz/vim-colorschemes' "色彩方案" All of your Plugins must be added before the following linecall vundle#end() " requiredfiletype plugin indent on " required" To ignore plugin indent changes, instead use:"filetype plugin on"" Brief help" :PluginList - lists configured plugins" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate" :PluginSearch foo - searches for foo; append `!` to refresh local cache" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal"" see :h vundle for more details or wiki for FAQ" Put your non-Plugin stuff after this line"vundle设置完毕syntax onlet g:tagbar_ctags_bin='/usr/local/bin/ctags'let g:tagbar_left = 1nnoremap安装cmake:TagbarToggle let NERDTreeWinPos='right'nnoremap :NERDTreeToggle nmap :SrcExplToggle let g:Srcexpl_winHeight = 8" // Set 100 ms for refreshing the Source Explorerlet g:SrcExpl_refreshTime = 100" // Set "Enter" key to jump into the exact definition contextlet g:SrcExpl_jumpKey = " "" // Set "Space" key for back from the definition contextlet g:SrcExpl_gobackKey = " "let g:SrcExpl_pluginList = [ \ "__Tag_List__", \ "_NERD_tree_" \ ]set tags=tags;/ "搜索上一级建立的tagnmap h "control+h进入左边的窗口nmap j "control+j进入下边的窗口nmap k "control+k进入上边的窗口nmap l "control+l进入右边的窗口" already done in .vim/bundle/SrcExpl/plugin/srcexpl.vim"map :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q . set foldenable " 开始折叠set foldmethod=syntax " 设置语法折叠set foldcolumn=0 " 设置折叠区域的宽度setlocal foldlevel=1 " 设置折叠层数为" set foldclose=all " 设置为自动关闭折叠 " " nnoremap @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo') " " 用空格键来开关折叠"set guifont=monaco\ Regular:h13
说明:brew install cmake 3。0。2失败的话,是由于之前没有屏蔽mac os x本身的路径。