[Ubuntu] 使用Vundle管理vim的插件

平时都有用着vim,安装的都是自己下载然后解压装到vim里面的。

刚才无意中看到一篇文章,说用Vundle可以管理vim的插件,于是试了一下,感觉很爽!

原文地址:http://williamherry.com/blog/2012/07/16/master-vim-01-vundle/

 

Vundle利用git,插件的git repo以及vim-scripts维护的GitHub repo, 自动安装, 更新和卸载插件. 它把这些繁杂的工作变得简单, 甚至, 成为一种享受.

安装

Vundle的github地址在这里,上面有安装和使用方法,我在这里也简单的写一下

1
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

配置

vim ~/.vimrc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
set nocompatible               " be iMproved
filetype off                   " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required! 
Bundle 'gmarik/vundle'
" My Bundles here:
filetype plugin indent on     " required!
"
" Brief help
" :BundleList          - list configured bundles
" :BundleInstall(!)    - install(update) bundles
" :BundleSearch(!) foo - search(or refresh cache first) for foo
" :BundleClean(!)      - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle command are not allowed..

使用

前面非常简单的步骤已经安装好了,那要怎么使用呢,这里以一个例子做说明,假设我们想安装NERDTree(下篇介绍)这个外挂,我的方法是:

  • 在github上搜索nerdtree找到它,我找到的是: https://github.com/scrooloose/nerdtree

  • 在~/.vimrc文件里添加一行:

1
Bundle 'scrooloose/nerdtree'
  • 退出并重新打开VIM,执行:BundleInstall,或者在命令行里面运行:vim +BundleInstall +qa

新的外挂NERDTree已经安装好了,可以在~/.vim/bundle/目录下看到它

 

 

我的配置信息:

set nocompatible               " be iMproved
filetype off                   " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required! 

Bundle 'gmarik/vundle'



""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""setting of nerdtree
Bundle 'scrooloose/nerdtree'
let NERDTreeWinPos='left'
let NERDTreeWinSize=31
let NERDTreeChDirMode=1
"F8 打开nerdtree
map f8 :NERDTreeToggle /media/My_Documents/htdocs<CR>
"F7 新开一个tab标签
map f7 :tabnew<CR>
"F5 前一个tab标签
map f5 :tabp<CR>
"F6 后一个tab标签
map f6 :tabn<CR>



""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""setting of nerdcommenter
Bundle 'scrooloose/nerdcommenter'



""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""setting of php_manual_for_vim
""""""""download url: http://pan.baidu.com/share/link?shareid=256523&uk=2802126572
""""""""detail tutorial: http://www.cnblogs.com/davidhhuan/archive/2013/01/13/2858123.html
set runtimepath+=~/.vim/doc/phpmanual
autocmd BufNewFile,Bufread *.ros,*.inc,*.php set keywordprg="help"

 

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Bundle 'kien/ctrlp.vim'

 

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Bundle 'Shougo/neocomplcache'
let g:neocomplcache_enable_at_startup=1

 

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""" Detail tutorial: http://www.cnblogs.com/davidhhuan/archive/2013/01/12/2857301.html
"Bundle 'vim-scripts/Yii-API-manual-for-Vim'
"autocmd BufNewFile,Bufread *.php set keywordprg="help"

 


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Bundle 'vim-scripts/PDV--phpDocumentor-for-Vim'
source ~/.vim/bundle/PDV--phpDocumentor-for-Vim/plugin/php-doc.vim
nnoremap <C-m> :call PhpDocSingle()<CR>i

 

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Bundle 'vim-scripts/Xdebug'



" My Bundles here:
filetype plugin indent on     " required!
"
" Brief help
" :BundleList          - list configured bundles
" :BundleInstall(!)    - install(update) bundles
" :BundleSearch(!) foo - search(or refresh cache first) for foo
" :BundleClean(!)      - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle command are not allowed..

""""""""""""""""""""""""""" svn
Bundle 'juneedahamed/svnj.vim'
let g:svnj_custom_statusbar_ops_hide = 1


if has("gui_running") "设置字符集 set encoding=utf-8 set fileencodings=ucs-bom,utf-8,chinese,prc,taiwan,latin-1,gbk,ucs-bom,cp936 set fileencoding=utf-8 let &termencoding=&encoding " 解决菜单乱码 source $VIMRUNTIME/delmenu.vim source $VIMRUNTIME/menu.vim " 解决consle输出乱码 language messages zh_CN.utf-8 endif "背景颜色 color slate "代码高亮 syntax enable syntax on "不备份 set nobackup "显示行号 set nu! "显示 bracets 配对 set showmatch "启动时大小 set lines=110 set columns=240 winpos 0 0 "不自动换行 set nolinebreak set wrap "历史数 set history=1024 "tab宽度 set tabstop=4 "tab自动缩进宽度 set shiftwidth=4 "设置自动缩进 set ai "将tab转换为空格 set expandtab "自动加载 _vimrc文件,无需重启GVim autocmd! bufwritepost _vimrc source % "默认隐藏gvim的菜单栏,用f2控制打开 set guioptions-=m set guioptions-=T map <silent> f2 :if &guioptions =~# 'T' <Bar> \set guioptions-=T <Bar> \set guioptions-=m <bar> \else <Bar> \set guioptions+=T <Bar> \set guioptions+=m <Bar> \endif<CR>

 

 

posted @ 2013-01-06 01:19  DavidHHuan  阅读(17463)  评论(0编辑  收藏  举报