# vim插件管理器的安裝和配置-windows
### 前言
-----------------------------
- vim做一框功能強大的編輯器,擴展功能令人稱奇,插件機制非常靈活
- 本篇推薦兩款vim的插件管理器vundle和vim-plug
- vundle是一款老款的插件管理工具
- vim-plug相對較新,特點是支持異步加載,相比vundle而言
### vundle
-----------------------------
#### 簡介
-----------------------------
- vundle是開源項目
- [項目地址](https://github.com/VundleVim/Vundle.vim)
#### 先決條件
-----------------------------
- git
- [下載地址](https://gitforwindows.org/)
- curl
- [下載地址](https://curl.haxx.se/download.html)
- 配置下環境變量
#### 安裝
-----------------------------
- `git clone https://github.com/VundleVim/Vundle.vim.git %USERPROFILE%/.vim/bundle/Vundle.vim`
- %USERPROFILE% 當前用戶路徑
#### 配置
-----------------------------
- 在`_vimrc`配置文件中添加如下內容
```
set nocompatible " 去掉vim的擴展,和vi保持兼容
filetype off " 關閉文件類型檢測
" set the runtime path to include Vundle and initialize
" 設置運行時路徑包括Vundle和初始化
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required 讓Vundle管理Vundle
Plugin 'VundleVim/Vundle.vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " 文件類型檢測插件,開啟
" 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
```
### vim-plug
-----------------------------
#### 簡介
-----------------------------
- vim-plug是開源項目
- [項目地址](https://github.com/junegunn/vim-plug)
#### 安裝
-----------------------------
- 下載plug.vim放在`auload`目錄下
#### 配置
-----------------------------
- 在`_vimrc`配置文件中添加如下內容
```
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
" 一款文本對齊的插件,非常神奇
Plug 'junegunn/vim-easy-align'
" Any valid git URL is allowed
" github公告板,刷帖
Plug 'https://github.com/junegunn/vim-github-dashboard.git'
" Multiple Plug commands can be written in a single line using | separators
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" On-demand loading 按需加載
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Using a non-master branch
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
" Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
Plug 'fatih/vim-go', { 'tag': '*' }
" Plugin options
Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
" Plugin outside ~/.vim/plugged with post-update hook
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
" Initialize plugin system
call plug#end()
```
### vim腳本插件
-----------------------------
- [vim腳本倉庫](http://vim-scripts.org/vim/scripts.html)
- [vim腳本倉庫,比較好用](https://vimawesome.com/)