分享

MAC OS X下的Linux环境

 看见就非常 2014-12-25

关键字: HomeBrew,好比Windows下的Cygwin

安装Homebrew

该si胜过macport

  1. ruby -e "$(curl -fsSL https://raw./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独立的环境变量

  1. export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin  
说明:该语句填入~/.bashrc文件是沒有用的,必须在命令行终端下输入或 source ~/.bashrc



升级 新版vim用于安装vim 自动补全插件

brew install vim

安装vundle管理vim插件

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


编写.vimrc配置vundle以安装插件

  1. "设置vundle  
  2. set nocompatible              " be iMproved  
  3. filetype off                  " required!  
  4.   
  5. " set the runtime path to include Vundle and initialize  
  6. set rtp+=~/.vim/bundle/Vundle.vim  
  7. call vundle#begin()  
  8. " alternatively, pass a path where Vundle should install plugins  
  9. "call vundle#begin('~/some/path/here')  
  10.   
  11. " let Vundle manage Vundle, required  
  12. Plugin 'gmarik/Vundle.vim'  
  13.   
  14. " The following are examples of different formats supported.  
  15. " Keep Plugin commands between vundle#begin/end.  
  16. " plugin on GitHub repo  
  17. Plugin 'tpope/vim-fugitive'  
  18. " plugin from http:///vim/scripts.html  
  19. Plugin 'L9'  
  20. " Git plugin not hosted on GitHub  
  21. "Plugin 'git://git.wincent.com/command-t.git'  
  22.   
  23. Plugin 'scrooloose/nerdtree'    "文件浏览  
  24. Plugin 'majutsushi/tagbar'      "代码符号  
  25. Plugin 'wesleyche/SrcExpl'      "类似sourceInsight的代码预览窗口  
  26. Plugin 'Valloric/YouCompleteMe' "自动补全  
  27. Plugin 'vim-scripts/a.vim'      "在头文件、源文件之间切换  
  28. Plugin 'flazz/vim-colorschemes' "色彩方案  
  29.   
  30. " All of your Plugins must be added before the following line  
  31. call vundle#end()            " required  
  32. filetype plugin indent on    " required  
  33. " To ignore plugin indent changes, instead use:  
  34. "filetype plugin on  
  35. "  
  36. " Brief help  
  37. " :PluginList       - lists configured plugins  
  38. " :PluginInstall    - installs plugins; append `!` to update or just  :PluginUpdate  
  39. " :PluginSearch foo - searches for foo; append `!` to refresh local cache  
  40. " :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal  
  41. "  
  42. " see :h vundle for more details or wiki for FAQ  
  43. " Put your non-Plugin stuff after this line  
  44. "vundle设置完毕  
  45.   
  46. syntax on  
  47. let g:tagbar_ctags_bin='/usr/local/bin/ctags'  
  48. let g:tagbar_left = 1  
  49. nnoremap <F3> :TagbarToggle<CR>  
  50. let NERDTreeWinPos='right'  
  51. nnoremap <F2> :NERDTreeToggle<CR>  
  52. nmap <F4> :SrcExplToggle<CR>  
  53. let g:Srcexpl_winHeight = 8  
  54. " // Set 100 ms for refreshing the Source Explorer  
  55. let g:SrcExpl_refreshTime = 100  
  56.   
  57. " // Set "Enter" key to jump into the exact definition context  
  58. let g:SrcExpl_jumpKey = "<ENTER>"  
  59.   
  60. " // Set "Space" key for back from the definition context  
  61. let g:SrcExpl_gobackKey = "<SPACE>"  
  62.   
  63. let g:SrcExpl_pluginList = [  
  64.          \ "__Tag_List__",  
  65.                  \ "_NERD_tree_"  
  66.                      \ ]  
  67.   
  68.   
  69. set tags=tags;/  "搜索上一级建立的tag  
  70.   
  71.   
  72.   
  73. nmap <C-H> <C-W>h "control+h进入左边的窗口  
  74. nmap <C-J> <C-W>j  "control+j进入下边的窗口  
  75. nmap <C-K> <C-W>k "control+k进入上边的窗口  
  76. nmap <C-L> <C-W>l  "control+l进入右边的窗口  
  77.   
  78. " already done in .vim/bundle/SrcExpl/plugin/srcexpl.vim  
  79. "map <F5> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>  
  80.   
  81.   
  82. set foldenable " 开始折叠  
  83. set foldmethod=syntax " 设置语法折叠  
  84. set foldcolumn=0 " 设置折叠区域的宽度  
  85. setlocal foldlevel=1 " 设置折叠层数为  
  86. " set foldclose=all " 设置为自动关闭折叠   
  87. " " nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR>  
  88. " " 用空格键来开关折叠  
  89. "  
  90.   
  91. set guifont=monaco\ Regular:h13  

安装cmake

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



    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多