vimvundle

Install plugin from specific branch


I'm using vundle to install vim plugins but I need to install YouCompleteMe from the branch fix-vim-eval-returning-py2-str because I have to use python3 and otherwise I get errors.

To do it I have download the master branch with vundle by :PluginInstall then I have to this:

cd ~/.vim/bundle
rm -rf YouCompleteMe
git clone -b fix-vim-eval-returning-py2-str https://github.com/puremourning/YouCompleteMe.git 
cd YouCompleteMe
git submodule update --init --recursive

To change the branch.

The problem is that sometimes vundle replace my brunch with master (that is not compatible with my system) and I must leave the line Plugin 'Valloric/YouCompleteMe' on my .vimrc or the plugin doesn't work. How can I workaround?


Solution

  • You can make this work while still using Vundle. After manually switching the branch of your clone with git, replace the Plugin line with this:

    Plugin 'Valloric/YouCompleteMe', {'pinned': 1}
    

    The 'pinned' option “tells Vundle not to perform any git operations on the plugin, while still adding the existing plugin under the bundles directories to the runtimepath.” So Vundle will not mess with your clone of YouCompleteMe anymore when you :PluginUpdate, it will just load the plugin.

    Note that this setting means you will have to update YouCompleteMe yourself, by using git pull within the plugin’s directory.