Vim plugin management tool: Pathogen

Source: Internet
Author: User
Tags autoload git clone

Source: http://www.cnblogs.com/taskiller/archive/2012/08/14/2637689.html

I. Introduction of Pathogen

Typically, the Vim plugin is installed, usually all the plug-ins and related DOC files are installed in a folder, such as the plug-in all installed in the/usr/share/vim/vim73/plugin/directory, the Help document installed all in the/usr/share/vim/ The vim73/doc/directory. The consequence of this is that it is cumbersome to modify and unload plugins, and it is difficult to figure out which file belongs to which plugin.


If you use pathogen to manage plug-ins, it becomes much more convenient. Pathogen allows each plugin to occupy a separate directory that solves the problem of file fragmentation. After installing pathogen, simply create a new directory ~/.vim/bundle/in the ~/.vim/directory and put all the plugins you want to install in the ~/.vim/bundle/directory. If you want to delete a plug-in, you only need to delete the corresponding plug-in directory in the ~/.vim/bundle/directory. If you want to keep a plug-in as the latest version, checkout a code into the bundle directory directly from the plugin's repository.


second, installation pathogen

Pathogen's download address is: Https://github.com/tpope/vim-pathogen

Can be extracted directly after download. The pathogen plugin only has a single script, so the installation is to put it in the current user's ~/.vim/autoload directory.

That is, copy the extracted AutoLoad directory together with the Pathogen.vim plugin inside the ~/.vim/directory.

third, enable pathogen

To enable pathogen, you will also need to add the following sentence in the ~/.VIMRC file, anywhere before filetype plugin indent on:

Call Pathogen#infect ()

Note: Here you need to explain that the plugin can not be placed in the/usr/share/vim/vim73/directory, and can only be placed in the ~/.vim/directory. To enable pathogen, you can only modify the ~/.VIMRC, not the/ETC/VIMRC (Ubuntu generally only needs to modify the ~/.VIMRC. If you are using fedora, you will need to modify the/ETC/VIMRC file if you want to make the plug-in or VIM configuration effective when you open vim as root.

If there is no ~/.VIMRC file, create the file and copy the following to the file:

Call Pathogen#infect ()
syntax on
filetype plugin indent on


To generate a Help document, just type it under vim: Call Pathogen#helptags ().

Iv. installation of new plugins

So far, pathogen has been enabled, to install a new plugin, just download the plugin and put it in the ~/.vim/bundle/directory.

1, installation Nerdtree

For example, to download the install Nerdtree plugin, simply go to the ~/.vim/bundle/directory and execute the following command:

git clone http://github.com/scrooloose/nerdtree.git

After the download is complete, you will see a new directory in the ~/.vim/bundle/directory: Nerdtree

Ok. The Nerdtree plugin is already installed. You can see that this approach is much simpler than the traditional Vim plug-in installation method.

and to uninstall the plug-in is also very simple, just need to delete the Nerdtree directory in the ~/.vim/bundle/directory, neat.

To update the plugin to the latest version, simply go to the directory ~/.vim/bundle/nerdtree/and execute the following command:

Git pull origin

Of course, this method of installing and updating plug-ins only works with Git-enabled methods in the Code warehouse.

For plugins that can't be downloaded with git, it's good to update the directory with the plugin name in the bundle.

2, Installation Tagbar

Tagbar can be used as an alternative to TagList, execute the installation command in the ~/.vim/bundle/directory as follows:

git clone https://github.com/majutsushi/tagbar.git


You can also set shortcut keys in the VIMRC file later:

Nmap <F4>:tagbartoggle<cr>   "set shortcut keys let
g:tagbar_width = +       " Set width, default to
autocmd Vimenter * Nested:call Tagbar#autoopen (1)    "Open vim automatically when open
tagbarlet g:tagbar_left = 1         " On the left "let
g:tagbar_right = 1        "on the right

List some of the areas that have been optimized compared to taglist:

(1) List of functions supporting header file display

Tagbar also makes a distinction between the visible levels of a function, using +-# and matching coloring to make a distinction.

(2) Better object-oriented support

TagList will also list the classes, but the overall is not intuitive.

(3) Automatically rebuild according to file modification time

TagList at this point experience is very bad, in fact, obviously can be achieved through this way of time stamping.

(it is said that Tagbar preferably configured ctags use, the effect will be better)

3. Install Supertab plug-in

The purpose of the Supertab plugin is to enable the TAB key on the keyboard to have a quicker auto-completion and contextual hints. Download and install the plugin in the ~/.vim/bundle/directory:

git clone https://github.com/ervandew/supertab.git

Once installed, you can use the auto-completion function directly in VIM. For example, to open a. c file with VIM, to declare a variable of type unsigned int, just enter Unsi, then press the TAB key, the keyword will be automatically filled, very useful.

v. Using pathogen to configure VIM syntax highlighting

Vim itself can set the keyword highlighting, but unable to set the function name and custom data structure highlighting, you can solve this problem through the Taghighlight plug-in.

First install the Taghighlight plugin and run the following command in the ~/.vim/bundle/directory:

HG Clone Https://bitbucket.org/abudden/taghighlight


Wait a short period of time, waiting for taghighlight download, you can use it.

Related Article

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.