How to manage Vim plug-ins

Source: Internet
Author: User

How to manage Vim plug-ins

Vim is a lightweight generic text editor on Linux. Although the learning curve at the beginning may be very difficult for general Linux users, it is worth all of this compared to its advantages. Vim can add more and more functions through fully customizable plug-ins. However, because its function configuration is difficult, you need to spend some time to understand its plug-in system before it can effectively customize Vim. Fortunately, we already have some tools that make it easier for us to use the Vim plug-in. In my daily use, Vundle is used.

 

What is Vundle?

Vundle refers to the Vim Bundle, which is a vim plug-in manager. Vundle allows you to easily install, upgrade, search, or clear plug-ins. It can also manage your running environment and help with labels. In this tutorial, we will show you how to install and use Vundle.

 

Install Vundle

First, if you do not have Git on your Linux system, install Git first.

Git server setup and Client installation

Fedora downloads Git through Http Proxy

Install Git on Ubuntu Server

Create a Git repository on the server (Ubuntu)

Git simple tutorial in Linux (taking Android as an example)

Git authoritative guide PDF

Git 2-minute Guide

Git details: click here
Git: click here

Then, create a directory where the Vim plug-in will be downloaded and installed. By default, this directory is ~ /. Vim/bundle.

  1. $ mkdir -p ~/.vim/bundle

Run the following command to install Vundle. Note that Vundle is also a vim plug-in. Therefore, we also install vundle to the previously created directory ~ /. Vim/bundle.

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

 

Configure Vundle

Now configure your. vimrc file as follows:

  1. Set nocompatible "required.
  2. Filetype off "required.
  3. "Set the path of your runtime environment here.
  4. set rtp+=~/.vim/bundle/Vundle.vim
  5. "Initialize vundle
  6. call vundle#begin()
  7. "This line should always start.
  8. Plugin 'gmarik/Vundle.vim'
  9. "This demo comes from https://github.com/gmarik/Vundle.vim README
  10. Plugin'tpope/vim-fugitive'
  11. "Plugin from http://vim-scripts.org/vim/scripts.html
  12. Plugin 'L9'
  13. "This Git plug-in is not on GitHub.
  14. Plugin'git://git.wincent.com/command-t.git'
  15. "Git repository path on the Local Computer (for example, when you are developing your own plug-in)
  16. Plugin 'file:///home/gmarik/path/to/plugin'
  17. "The vim script sparkup is stored in a sub-directory under the vim repository.
  18. "Set this path to runtimepath correctly.
  19. Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
  20. "Avoid conflicts with the name of '9'
  21. Plugin'user/L9',{'name':'newL9'}
  22. "All plug-ins should be before this line.
  23. Call vundle # end () "is required.

Let me briefly explain the above settings: by default, Vundle will download and install the vim plug-in from github.com or the vim-scripts.org. You can also change the default behavior.

To install the plug-in from github:

  1. Plugin'user/plugin'

To install:

  1. Plugin'plugin_name'

To install it from another git Repository:

  1. Plugin'git://git.another_repo.com/plugin'

Install from a local file:

  1. Plugin'file:///home/user/path/to/plugin'

You can also customize other things, such as the runtime path of your plug-in. When you write a plug-in yourself, or you just want to get it from other directories -- instead ~ /. Vim -- this is very useful when loading plug-ins.

  1. Plugin'rstacruz/sparkup',{'rtp':'another_vim_path/'}

If you have plug-ins with the same name, you can rename your plug-ins so that they will not conflict.

  1. Plugin'user/plugin',{'name':'newPlugin'}

 

Use the Vum command

Once you use vundle to set your plug-ins, you can install, upgrade, search for plug-ins using several vundle commands, or clear useless plug-ins.

 

Install a new plug-in

PluginInstallThe command will install all the plug-ins listed in your. vimrc file. You can also pass a plug-in name to install a specific plug-in.

  1. :PluginInstall
  2. : PluginInstall <plug-in Name>

 

Clear unused plug-ins

If you have any unused plug-ins, you can usePluginCleanCommand to delete it.

  1. :PluginClean

 

Find a plug-in

If you want to install a plug-in from the provided plug-in list, the search function is very useful.

  1. : PluginSearch <text>

When searching, you can install, clear, re-search, or re-load the plug-in list in the interactive split window. The installed plug-ins do not take effect automatically. To make the plug-ins take effect, you can add them to your. vimrc file.

 

Summary

Vim is a wonderful tool. It is not just a default text editor that makes your work smoother and more efficient, but it also changes and becomes an existing IDE for almost any programming language.

Note that some websites can help you find the appropriate vim plug-in. Slam the http://www.vim-scripts.org, Github, or http://www.vimawesome.com to get a new script or plug-in. Remember to use the help provided by your plug-in.

Get up with your favorite editor!

-------------------------------------- Split line --------------------------------------

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

-------------------------------------- Split line --------------------------------------

Via: http://xmodulo.com/manage-vim-plugins.html

Author: Christopher Valerio Translator: XLCYun (sleeve Hidden Cloud) 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.