How to Use NeoBundle to manage Vim plug-ins

Source: Internet
Author: User

How to Use NeoBundle to manage Vim plug-ins

NeoBundle is a Vim plug-in Manager based on Vundle (Vundle is a Pathogen-based Vim plug-in manager ). In my previous articles, I highly recommend using Neobundle because it was still in the high-speed development stage (LCTT: Meaning unstable and variable ), at that time, there were very few English documents. Now, more than a year has passed, and these two problems are no longer the problem.

Why should we use the plug-in manager? Vim supports a large number of plug-ins, but because it does not strictly define the framework, plug-in files can be randomly distributed in different directories, making it difficult for users to manage (LCTT: of course, the premise is that you have a lot of plug-ins and a little bit of obsessive-compulsive disorder. I think these plug-ins will be more comfortable ). A plug-in manager makes management much easier. The job of Pathogen, Vundle, and NeoBundle is to create a directory for different plug-ins and then throw these directories ~ /. Vim/bundle directory. This file sorting method allows you to easily and thoroughly Delete the plug-in. You can use 'rm-rf <plug-in directory> 'or directly Delete the directory where the plug-in is located in the File Manager, there is no residue in absolute green environment. At the same time, this method can avoid incompatibility between plug-ins and plug-ins to the greatest extent.

Build VIM into a simple and practical IDE

Vim Learning Guide

Quick learn Vi Editor

Powerful Vim Editor

Build a Vim Development Environment on CentOS 6.2

Install the highlighted Vim editing tool in CentOS 5.4

Vim tips: C language settings

Set the Vim row number in Ubuntu

Vim editor basic tutorial

NeoBundle is a Vundle-based project. Like Vundle, they can both install and upgrade plug-ins. However, the description file of NeoBundle clearly states: "NeoBundle is not a stable plug-in manager. If you want a stable plug-in Manager, select Vundle ". The latest release-note also has a warning that "compatibility problems may occur"-this is an annotation written by a developer, indicating that this manager cannot be safely used.

So why should we use NeoBundle? It cannot guarantee stable operation! Well, it still has merits. Vundle only supports version control systems such as Git, while NeoBundle supports Subversion and Mercurial. Another reason is that if you do not want the plug-in to damage your Vim ecosystem during upgrade, you can lock the NeoBundle so that it can only use a fixed version of a plug-in.

In addition, Shougo Matsuishita (LCTT: Name looks like Japanese), The NeoBundle creator, is adding its command interface to other plug-in projects to reduce their command usage. Currently, NeoBundle supports three plug-ins: unite. the file and cache manager used by vim and Vim; vimshell. the script program used by vim and Vim; vimproc. vim, running in vimshell. vim, used to support asynchronous events. All of the above are special cases and there is no English document, so users want to improve them. Before using them, we need to focus on some basic operations first.

Install and initialize NeoBundle

NeoBundle supports Vim 7.2.051 or later and requires git and cURL (used to download files ). You can manually download NeoBundle or use cURL to download its repository on GitHub. Use the following command in your home directory to download the NeoBundle plug-in to the. vim/bundle/neobundle. vim directory, and then manage the NeoBundle.

  1. Curl https://raw.githubusercontent.com/Shougo/neobundle.vim/master/bin/install.sh | sh

You also need to modify the. vimrc file. The GitHub homepage of NeoBundle provides a. vimrc template, but you need to install five plug-ins without using this template. If you do not need them, you can use the following minimum Configuration:

  1. If has ('vim _ starting ')
  2. Set nocompatible
  3. Set runtimepath + = ~ /. Vim/bundle/neobundle. vim/
  4. Call neobundle # begin (expand ('~ /. Vim/bundle /'))
  5. NeoBundleFetch 'shougo/neobundle. vim'
  6. Call neobundle # end ()
  7. Filetype plugin indent on

The purpose of the above configuration is to start NeoBundle and upgrade itself like other plug-ins. NeoBundle is downloaded and upgraded from GitHub by default. If you are using GitHub, you only need to specify the username and path of the maintainer for this plug-in. In the above configuration, NeoBundleFetch only needs to be specified as "Shougo/neobundle. vim", rather than the complete GitHub path. If you want to use other websites, such as Subversion or Mecurial websites, you need to add the complete URL.

To install other plug-ins, run the following command:

  1. Curl-k https://github.com/?project maintainer #/# ]> ~ /. Vim/bundle/[plug-in path]

For example, to install vim-abolish, a text search and replacement plug-in for super NB, run the following command:

  1. Curl-k https://github.com/tpope/vim-abolish> ~ /. Vim/bundle/abolish

If you want it to be automatically upgraded, add a line below the line of NeoBundleFetch:

  1. NeoBundle 'tpope/vim-abolish'

TIPS: You can specify a branch or version number for the plug-in. What does it mean? NeoBundle only uses a branch or version of the plug-in, and ignores version updates. If a plug-in you are using is in a high-speed development process, you can use this technique to avoid using the plug-in version with bugs. For example:

  1. NeoBundle 'shougo/vimshell', {'rev': '3787e5 '}

Another trick is to add a row of "NeoBundleCheck" attributes in the. vimtc file. NeoBundle checks plug-ins that are not installed according to the configuration and prompts you to install them. You can also use the command ": NeoBundleInstall" (LCTT: enter it in the command mode of the Vim Editor) to install or upgrade the plug-in.

NeoBundle usage

Many NeoBundle commands are similar to Vundle, but their names are different. The usage of the NeoBundle command is as follows:

  • : NeoBundleUpdate: install or upgrade the plug-in. If you manually delete the directory of a plug-in, this command will reinstall the plug-in. Add the plug-in name after this command to upgrade only one plug-in. Without parameters, all plug-ins installed but not recorded will be recorded. : The NeoBundleInstall command has the same effect.
  • : NeoBundle {repository uri} [[REVISION}] [, OPTIONS}]: locks a plug-in to a fixed version to prevent random upgrades.
  • : NeoBundleList: list all uninitialized plug-ins.
  • : NeoBundleClean: Enter the interaction interface and delete the plug-in.

When these commands are used with unite. vim (LCTT: one of the 32 examples mentioned above), the effect is slightly different. You can use the ": help neobundle" command to learn more.

Determine whether to use NeoBundle.

NeoBundle is a powerful tool and is under high-speed development. Any project in this status will be posted with "promising" and "unstable" labels, depending on your choice. If you want the latest stable version of the plug-in, NeoBundle can pull Vundle and Pathogen out of several streets.

However, the online help documentation has given a warning that it is not a stable product. if the version is not updated in time, some plug-ins may run incorrectly. Finally, you need to specify a stable version for your Neoundle and Other plug-ins in the. vimrc file. Remember this warning, and you can easily use these cutting-edge technologies.

Via: http://www.openlogic.com/wazi/bid/348084/Managing-Vim-extensions-with-NeoBundle

Translator: bazz2 Proofreader: wxy

This article was originally translated by LCTT and launched with the Linux honor in China

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.