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指令行工具東東,安裝之後可以讓類C的語言怎樣怎樣的鬼東西xcode-select --install
- 接下來就是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# 支援
, 前面msbuild是windows系統的,後面是其他類型系統YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer -> 運作msbuild/xbuild
- Go語言的支援:
$ cd ~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/gocode $ go build
- TypeScript:
, 這個和JS都需要nodejs和npm支援,由于本來就喜歡折騰,這兩個東東很早就裝上了npm install -g typescript
- Javascript:現在正在從事的工作,看到這個高興了一把,嘿嘿-_-!
$ cd ~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/tern_runtime $ npm install --production
總結
到此結束了,其實都是簡單的過程,也沒啥要總結的了。為了折騰這個東西前天晚上花了一晚上,整到四點鐘,不管怎樣還是整好了,後面就慢慢的往裡面添加東西了,來打造屬于自己的vim開發環境了,嘿嘿!!(安裝還是蠻簡單的,不要噴,誰讓自己年輕氣盛走了彎路呢。親身感受,希望同學們不要輕信所謂的年輕就是要去闖,不要怕頭破血流之類的話,如果沒有深厚的背景來承受失敗的後果,和給你東山再起的資本,真的真的真的傷不起,是以踏踏實實做自己喜歡的的工作是最重要的。是以這幾年别人在積累而我又要重頭開始,但是既然熱愛,就慢慢積累吧,并且生活還是要積極陽光,還是要努力去奮鬥嘛^_^!!!!)。