MAC OS X下的Linux环境

时间:2021-11-08 16:04:53

关键字: 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以安装插件

"设置vundle
set nocompatible " be iMproved
filetype off " required! " set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here') " let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim' " The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
Plugin '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 line
call vundle#end() " required
filetype 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 on
let g:tagbar_ctags_bin='/usr/local/bin/ctags'
let g:tagbar_left = 1
nnoremap <F3> :TagbarToggle<CR>
let NERDTreeWinPos='right'
nnoremap <F2> :NERDTreeToggle<CR>
nmap <F4> :SrcExplToggle<CR>
let g:Srcexpl_winHeight = 8
" // Set 100 ms for refreshing the Source Explorer
let g:SrcExpl_refreshTime = 100 " // Set "Enter" key to jump into the exact definition context
let g:SrcExpl_jumpKey = "<ENTER>" " // Set "Space" key for back from the definition context
let g:SrcExpl_gobackKey = "<SPACE>" let g:SrcExpl_pluginList = [
\ "__Tag_List__",
\ "_NERD_tree_"
\ ] set tags=tags;/ "搜索上一级建立的tag nmap <C-H> <C-W>h "control+h进入左边的窗口
nmap <C-J> <C-W>j "control+j进入下边的窗口
nmap <C-K> <C-W>k "control+k进入上边的窗口
nmap <C-L> <C-W>l "control+l进入右边的窗口 " already done in .vim/bundle/SrcExpl/plugin/srcexpl.vim
"map <F5> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR> set foldenable " 开始折叠
set foldmethod=syntax " 设置语法折叠
set foldcolumn=0 " 设置折叠区域的宽度
setlocal foldlevel=1 " 设置折叠层数为
" set foldclose=all " 设置为自动关闭折叠
" " nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR>
" " 用空格键来开关折叠
" set guifont=monaco\ Regular:h13

安装cmake

说明:brew install cmake 3。0。2失败的话,是由于之前没有屏蔽mac os x本身的路径。