歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Vim插件管理器Vundle使用

Vim插件管理器Vundle使用

日期:2017/2/28 14:55:28   编辑:Linux教程

Vundle(Vim bundle) 是一個vim的插件管理器。

其Github地址為: https://github.com/gmarik/vundle

如何使用Vundle (個人使用環境為Ubuntu 12.10)

1. 從Github下載vundle到本地:

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

2. 配置vimrc文件:

如果是使用ubuntu apt安裝的vim,其vimrc一般應該在/etc/vim/目錄下

有些人的vimrc文件可能在個人工作目錄下,為.vimrc文件

在vimrc文件中修改並按照下面例子加入相應需要的語句。

set nocompatible " be iMproved
filetype off " required! /** 從這行開始,vimrc配置 **/

set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'

" My Bundles here: /* 插件配置格式 */
"
" original repos on github (Github網站上非vim-scripts倉庫的插件,按下面格式填寫)
Bundle 'tpope/vim-fugitive'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
Bundle 'tpope/vim-rails.git'
" vim-scripts repos (vim-scripts倉庫裡的,按下面格式填寫)
Bundle 'L9'
Bundle 'FuzzyFinder'
" non github repos (非上面兩種情況的,按下面格式填寫)
Bundle 'git://git.wincent.com/command-t.git'
" ...

filetype plugin indent on " required! /** vimrc文件配置結束 **/
" /** vundle命令 **/
" 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..

注意,vundle會自動給你下載和管理插件,所以,你只要填上你所需要的插件名稱即可。對於不同類型的插件,有不同的地址填寫方法。按上面的方法填寫完畢就可以了。

填寫完成,保存退出後,打開一個vim窗口。在命令模式下輸入

:BundleList //會顯示你vimrc裡面填寫的所有插件名稱

:BundleInstall //會自動下載安裝或更新你的插件。

PS: https://github.com/vim-scripts 和 http://vim-scripts.org/vim/scripts.html 這兩個網站上都是vim-scripts的插件,即你只需在vimrc中添加你想要的插件名稱即可。

Copyright © Linux教程網 All Rights Reserved