Vundle是VIM的插件管理器,他的Github的项目托管网站是:
https://github.com/VundleVim/Vundle.vim

下面,我会在自己的Linux中,为我的VIM安装Vundle。


首先,你需要有Git:

查看Git版本:
[root@linux ~]# git --version
git version 1.8.3.1
[root@linux ~]# 

如果没有Git,可以使用下面的这个命令安装:
yum install -y git

从GitHub克隆最新的Vundle:

[root@linux ~]# pwd
/root
[root@linux ~]# 
[root@linux ~]# ls -ltra | grep vim
[root@linux ~]# 
[root@linux ~]# git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
Cloning into '/root/.vim/bundle/Vundle.vim'...
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 3140 (delta 0), reused 0 (delta 0), pack-reused 3139
Receiving objects: 100% (3140/3140), 935.39 KiB | 67.00 KiB/s, done.
Resolving deltas: 100% (1106/1106), done.
[root@linux ~]# 
[root@linux ~]# ls -ltra | grep vim
drwxr-xr-x   3 root root   20 Jul  6 21:19 .vim
[root@linux ~]# 
[root@linux ~]# du -sh .vim
1.3M    .vim
[root@linux ~]# 
[root@linux ~]# ls -ltr .vim/
total 0
drwxr-xr-x 3 root root 24 Jul  6 21:19 bundle
[root@linux ~]# 
[root@linux ~]# ls -ltr .vim/bundle/
total 0
drwxr-xr-x 8 root root 254 Jul  6 21:19 Vundle.vim
[root@linux ~]# 
[root@linux ~]# ls -ltr .vim/bundle/Vundle.vim/
total 48
-rw-r--r-- 1 root root 6935 Jul  6 21:19 README_ZH_TW.md
-rw-r--r-- 1 root root 7040 Jul  6 21:19 README_ZH_CN.md
-rw-r--r-- 1 root root 6448 Jul  6 21:19 README.md
-rw-r--r-- 1 root root 7594 Jul  6 21:19 README_KR.md
-rw-r--r-- 1 root root 1068 Jul  6 21:19 LICENSE-MIT.txt
-rw-r--r-- 1 root root 6191 Jul  6 21:19 CONTRIBUTING.md
drwxr-xr-x 3 root root   38 Jul  6 21:19 autoload
drwxr-xr-x 3 root root   50 Jul  6 21:19 test
drwxr-xr-x 2 root root   27 Jul  6 21:19 syntax
drwxr-xr-x 2 root root   27 Jul  6 21:19 ftplugin
drwxr-xr-x 2 root root   24 Jul  6 21:19 doc
-rw-r--r-- 1 root root  809 Jul  6 21:19 changelog.md
[root@linux ~]# 

在Linux用户的家目录中编辑文件【.vimrc】
例如,我当前的用户是【root】,因此我需要编辑的这个文件的绝对路径就是【/root/.vimrc】:

[root@linux ~]# ls -ltra | grep vim
drwxr-xr-x   3 root root   20 Jul  6 21:19 .vim
[root@linux ~]# 
[root@linux ~]# vi .vimrc
[root@linux ~]# 
[root@linux ~]# ls -ltra | grep vim
drwxr-xr-x   3 root root   20 Jul  6 21:19 .vim
-rw-r--r--   1 root root 1736 Jul  6 21:23 .vimrc
[root@linux ~]# 
[root@linux ~]# cat .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
[root@linux ~]# 

然后,就可以安装插件了:
安装插件有两种方式:
1. 通过【vim】界面安装
2. 通过命令行安装

通过【VIM】界面安装:
【:PluginInstall】

界面效果如下:

这个过程中,可以看到VIM的插件的目标目录【~/.vim/bundle】的容量越来越大:
[root@linux ~]# du -sh .vim/bundle/
6.0M    .vim/bundle/
[root@linux ~]# 
[root@linux ~]# du -sh .vim/bundle/
8.0M    .vim/bundle/
[root@linux ~]# 

如果不喜欢上面这种方式,你还可以选择通过【命令行】去安装:

vim +PluginInstall +qall

说点什么

avatar

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

  Subscribe  
提醒
隐藏
变装