📜 ⬆️ ⬇️

Another plugin manager for Vim

For Vim there are several plugin managers. I want to talk about one more thing.

Introduction


On Habré there were already reviews of plug-in managers: one , two . Consider another: VIM-PLUG . This manager has a number of interesting features:

In the article, the author tells about the reasons that prompted him to write another plugin. And this article compares the performance of plug-ins.

Installation and Basic Setup


To install the plugin, just download one file:

curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim 

And you can add the following fragment to .vimrc:
')
 if empty(glob("~/.vim/autoload/plug.vim")) execute '!curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.github.com/junegunn/vim-plug/master/plug.vim' endif 

and the plugin will be installed when Vim starts up for the first time.

Next, add information about the installed plugins:

 call plug#begin('~/.vim/plugged') Plug 'scrooloose/nerdtree' " Project and file navigation Plug 'majutsushi/tagbar' " Class/module browser Plug 'fisadev/FixedTaskList.vim' " Pending tasks list ... Plug 'freeo/vim-kalisi' call plug#end() 

To install plugins, you need to run the command PlugInstall , for updating - PlugUpdate :



A separate PlugUpgrade command is used to update the plug-in itself, while PlugClean is used to remove plug- ins .

Additional settings


When configuring, you can specify a specific type of file for which the specified plugin will be loaded. Of course, a well-written plugin should be able to do this itself, but this is not always the case:

 Plug 'itchyny/vim-cursorword', {'for': 'python'} 

You can also specify a command and VIM-PLUG will load the plugin on the first attempt to execute this command:

 Plug 'fmoralesc/vim-pad', {'on': 'Pad'} 

Some plugins require additional actions after their installation. VIM-PLUG can help in this case:

 Plug 'Valloric/YouCompleteMe', {'do': 'sudo ./install.sh'} 

I have a small problem with YouCompleteMe
I had to manually perform the first installation:

 git submodule update --init --recursive 


You can also specify a branch or tag from which you should get the plugin code:

 Plug 'xvadim/vim-cursorword', {'branch': 'feature', 'for': ['python', 'bash']} 

Conclusion


The best way to get bored is to tell everything to the end. In addition to those considered, this manager also supports an additional range of features that can be found on the project page .

Source: https://habr.com/ru/post/250525/


All Articles