MacVim安装过程整理
前言
通过百度和Google找了很多关于MacVim的安装文章,筛选了两篇,按照流程走下来,折腾了很久还是失败了,最后索性把之前做的全部删掉回退了,先了解了下MacVim。发现,重要的就两个工具的安装,插件管理:Vundle和YouCompleteMe工具的安装,并且他们官网上就有详细的安装教程(傻逼了。。。),接下来………………Y(^_^)Y!
通过命令行安装vim/macvim和其他工具
- brew install vim
- brew install macvim
- brew install ctags
- brew install cscope
- ctags -R
- cscope -Rbq
安装插件管理工具:Vundle
git vundle(没有bundle文件夹,可以 自己手动创建)
$ mkdir ~/.vim/bundle $ cd ~/.vim/bundle $ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
配置文件.vimrc,把官网上的内容copy下来直接放进.vimrc就可以了
set nocompatible " be iMproved, required 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 'VundleVim/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' " git repos on your local machine (i.e. when working on your own plugin) Plugin 'file:///home/gmarik/path/to/plugin' " The sparkup vim script is in a subdirectory of this repo called vim. " Pass the path to set the runtimepath properly. Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} " Install L9 and avoid a Naming conflict if you've already installed a " different version somewhere else. Plugin 'ascenator/L9', {'name': 'newL9'} " 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来安装插件了,包括YCM,我是通过YCM github介绍手动安装的,介绍是从头看到尾了,该装的也装了,没必要装的也搞上去了^_^,反正是折腾……!
YouCompleteMe
ln -s /usr/local/bin/mvim vim
简单,大家都懂!xcode-select --install
xcode命令行工具东东,安装之后可以让类C的语言怎样怎样的鬼东西- 接下来就是cmake了,可以通过开始提到的命令安装:
brew install cmake
安装编译
cd ~/.vim/bundle/YouCompleteMe ./install.py --clang-completer // 执行这个的时候好像会有个提示,什么东西忘记了,按照它的提示,复制下来用sudo执行下就可以了,需要等待一会 // 完成之后再重复上面的命令,之后执行 cd ~/.vim/bundle/YouCompleteMe ./install.py // 也可以单独安装,针对单个语言,那么麻烦直接all了 cd ~/.vim/bundle/YouCompleteMe ./install.py --all
继续,下面步骤不知道是什么鬼(貌似也是跟语言的支持相关……),跟着做了,以后边用边了解吧
cd ~ mkdir ycm_build mkdir ycm_temp // 忘记这个了 - -! cd ycm_build // 我的是Mac OS,所以用了:"Unix Makefiles" cmake -G "<generator>" . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp // 设置根路径 cmake -G "<generator>" -DPATH_TO_LLVM_ROOT=~/ycm_temp/llvm_root_dir . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp // 编译库文件 cmake --build . --target ycm_core /* --config Release 这个参数Window上使用,Unix类系统会被自动忽略 */
- 后面是其他语言的支持了,直接复制了
- C# 支持
YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer -> 运行msbuild/xbuild
, 前面msbuild是windows系统的,后面是其他类型系统 Go语言的支持:
$ cd ~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/gocode $ go build
TypeScript:
npm install -g typescript
, 这个和JS都需要nodejs和npm支持,由于本来就喜欢折腾,这两个东东很早就装上了- Javascript:现在正在从事的工作,看到这个高兴了一把,嘿嘿-_-!
$ cd ~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/tern_runtime $ npm install --production
总结
到此结束了,其实都是简单的过程,也没啥要总结的了。为了折腾这个东西前天晚上花了一晚上,整到四点钟,不管怎样还是整好了,后面就慢慢的往里面添加东西了,来打造属于自己的vim开发环境了,嘿嘿!!(安装还是蛮简单的,不要喷,谁让自己年轻气盛走了弯路呢。亲身感受,希望同学们不要轻信所谓的年轻就是要去闯,不要怕头破血流之类的话,如果没有深厚的背景来承受失败的后果,和给你东山再起的资本,真的真的真的伤不起,所以踏踏实实做自己喜欢的的工作是最重要的。所以这几年别人在积累而我又要重头开始,但是既然热爱,就慢慢积累吧,并且生活还是要积极阳光,还是要努力去奋斗嘛^_^!!!!)。