Another plugin manager for Vim

    There are several plugin managers for Vim. I want to talk about one more thing.

    Introduction


    Habré already had reviews of plugin managers: one , two . Consider one more: VIM-PLUG . This manager has a number of interesting features:
    • Easy to install (plugin code is contained in a single file)
    • Quick installation and updating of plugins (if Vim is built with the + ruby option )
    • Branch and tag support
    • Post processing

    In the article, the author talks about the reasons that prompted him to write another plugin. And this article compares the performance of plugins.

    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
    

    Or you can add the following snippet 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 at the first start of Vim.

    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 must run the PlugInstall command , to upgrade PlugUpdate :



    To update the plugin itself, use a separate PlugUpgrade command , to remove plugins - PlugClean .

    Additional settings


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

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

    You can also specify a command and VIM-PLUG will load the plugin the first time you try to execute this command:

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

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

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

    I got a little problem with YouCompleteMe
    during the first installation I had to manually perform:

    git submodule update --init --recursive
    


    You can also specify the branch or tag from which to take 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 reviewed, this manager supports an additional number of features that can be found on the project page .

    Also popular now: