VundleVim的安装与使用

时间:2022-05-22 00:09:20

git:https://github.com/VundleVim/Vundle.vim

vundle是一款vim编辑器的插件管理软,用起来很方便的原因有几点:

1)只要知道插件名称,就能搜索到并下载安装(前提是vundle支持的插件,如果不支持也可以用其他方式安装);

2)更新,清除插件都是很简单的指令就解决。

3)很多东西都是依赖于git,这样就更方便了。

Quick Start 快速上手

  1. Introduction: (如果在linux下的话,直接看第2步)

    Installation requires Git and triggers git clone for each configured repository to ~/.vim/bundle/ by default. Curl is required for search.

    If you are using Windows, go directly to Windows setup. If you run into any issues, please consult the FAQ. See Tips for some advanced configurations.

    Using non-POSIX shells, such as the popular Fish shell, requires additional setup. Please check the FAQ.

  2. Set up Vundle:   (下载vundle。前提是你装了git,最好会使用git。安装git: sudo apt-get install git)

    $ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

  3. Configure Plugins:    (在~/目录下创建.vimrc文件,并将以下内容贴进去。“~/”目录其实就是“home/用户名/ ”目录下)

    Put this at the top of your .vimrc to use Vundle. Remove plugins you don't need, they are for illustration purposes.

    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/'}
    " Avoid a name conflict with L9
    Plugin 'user/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
  4. Install Plugins:   (最后一步了,在命令行敲入vim回车,然后输入以下有颜色的指令。以下二选一即可。)

    Launch vim and run :PluginInstall

    To install from command line: vim +PluginInstall +qall

Docs

在安装完成之后就可以使用如下命令查看vundle的一些使用方法啦:

:h vundle

如果要用到vundle的话,在vim打开的情况下,在其控制模式中输入命令就可以了。常用命令有如下四个:

  • 更新插件  ":BundleUpdate"
  • 清除不再使用的插件  ":BundleClean"
  • 列出所有插件  ":BundleList"
  • 查找插件(查到的直接按i就能安装了)  ":BundleSearch"       

以下是一些说明:

  上面的PluginSearch指令所找出来的插件都在https://github.com/vim-scripts,这个git上可以找到一些插件的设置方法,文档说明等等。