MAC OS X下的Linux環境

關鍵字: HomeBrew,比如Windows下的Cygwinhtml

安裝Homebrew

該si賽過macport
python

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

說明:程序在/usr/local/Library/下。之後軟件包下載到/Library/Caches/Homebrew下,安裝在路徑/usr/local/Cellar下,並自動連接到/usr/local下各個子目錄中c++


安裝macvim

brew install macvimgit


配置

mac os x自己有一套vim、python、ctags之類,須要屏蔽。設置命令行下brew獨立的環境變量github

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
說明:該語句填入~/.bashrc文件是沒有用的,必須在命令行終端下輸入或 source ~/.bashrc



升級 新版vim用於安裝vim 自動補全插件vim

brew install vimruby

安裝vundle管理vim插件bash

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


編寫.vimrc配置vundle以安裝插件app

"設置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自己的路徑。

curl

相關文章
相關標籤/搜索