記錄下自己的YouCompleteMe安裝步驟:
vim沒有代碼自動補全功能是非常不爽的。
1、先明確一點: MAC 自帶的VIM 是7.3版本,而YouCompleteMe安裝需要7.3版以上的vim。
使用MAC自帶的vim安裝YouCompleteMe會出現問題如下:
2、安裝YouCompleteMe之前要先安裝Budle插件(vundle插件):
vundle插件安裝比較簡單:
在$HOME/.vimrc 文件頂部貼入下列代碼:
set nocompatible " 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 'gmarik/Vundle.vim' " Add all your plugins here (note older versions of Vundle used Bundle instead of Plugin) " All of your Plugins must be added before the following line call vundle#end() " required filetype plugin indent on " required
代碼設置好之后,然后隨便打開一個vim , 在命令模式下輸入:PluginInstall
自動安裝插件, 會在$HOME/ 下生成一個 .vim 文件夾,
./vim/bundle/ 文件中是 安裝的所有插件文件。
就可以使用Budle安裝插件了。
Bundle 'Valloric/YouCompleteMe'
Bundle 語句必須在call vundle#begin()和call vundle#end()之間,不能放錯位置。
然后隨便打開一個vim , 在命令模式下輸入:BundleInstall 就可以自動安裝插件了。
3 、由於MAC自帶的vim版本不夠, 所有安裝了MacVim,
使用homebrew進行安裝:
brew install macvim
使用brew安裝macvim成功之后,使用命令: brew linkapps macvim ,才會生成macvim 應用標志,(命令行 會有提示)
由於macvim 和 vim 使用的是同一個.vimrc 配置文件。(也可以設置成使用macvim 代替原來的vim,我沒有這樣設置)
在命令行中: mvim 可以打開macvim 界面。
要安裝成功cd ~/.vim/bundle/YouCompleteMe
還要先安裝一個CMake :
brew install CMake
都安裝成之后。按照2中介紹的, 配置完,安裝YouCompleteMe成功后會在$HOME/.vim/bundle 下生成YouCompleteMe文件夾,如下圖所示:
執行一下命令安裝自動補全功能:
cd ~/.vim/bundle/YouCompleteMe
./install.py -omnisharp-completer : C# 補全功能
./install.py -all 所有
PS: 附加幾個相關鏈接
4、mac上截圖快捷鍵:
shift + command + 4 : 自定義截圖
shift + command + 3 : 全屏截圖
5、vim --version , mvim --version 查看vim版本
6、安裝過程中可能會出錯誤,仔細看安裝的提示, 即使某一步安裝成功了也要自習看安裝提示,英語非常有用啊
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。