From f3da68779ad06db096313fd9ddcbb8325157acb6 Mon Sep 17 00:00:00 2001 From: Jacobo de Vera Date: Thu, 10 Nov 2011 23:50:31 +0000 Subject: [PATCH] Support plugin pinning New supported option called 'pinned' for the Plugin command. When set to 1, the plugin is added to rtp but no install/upgrade operation is performed. It not only allows vundle to do rtp management of plugins on VCS other than git, it also allows leaving plugins that had previously been managed by vundle in the current state, with no further updates. Fixes #24, #397 --- autoload/vundle.vim | 1 + autoload/vundle/config.vim | 4 ++++ autoload/vundle/installer.vim | 7 +++++++ doc/vundle.txt | 22 +++++++++++++++++++++- test/vimrc | 7 +++++++ 5 files changed, 40 insertions(+), 1 deletion(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index 83d6c90..e41693d 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -54,6 +54,7 @@ sign define Vu_new text=+ texthl=Comment sign define Vu_updated text=* texthl=Comment sign define Vu_deleted text=- texthl=Comment sign define Vu_helptags text=* texthl=Comment +sign define Vu_pinned text== texthl=Comment endif diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index a496752..785d43c 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -134,3 +134,7 @@ func! s:bundle.path() return s:expand_path(g:bundle_dir.'/'.self.name) endf +func! s:bundle.is_pinned() + return get(self, 'pinned') +endf + diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index c96e078..245dd74 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -67,6 +67,8 @@ func! vundle#installer#run(func_name, name, ...) abort echo n.' deleted' elseif 'helptags' == status echo n.' regenerated' + elseif 'pinned' == status + echo n.' pinned' elseif 'error' == status echohl Error echo 'Error processing '.n @@ -219,6 +221,11 @@ func! s:helptags(rtp) abort endf func! s:sync(bang, bundle) abort + " Do not sync if this bundle is pinned + if a:bundle.is_pinned() + return 'pinned' + endif + let git_dir = expand(a:bundle.path().'/.git/', 1) if isdirectory(git_dir) || filereadable(expand(a:bundle.path().'/.git', 1)) if !(a:bang) | return 'todate' | endif diff --git a/doc/vundle.txt b/doc/vundle.txt index a6c35e2..3cffe91 100644 --- a/doc/vundle.txt +++ b/doc/vundle.txt @@ -166,6 +166,26 @@ This can be used to prevent name collisions between plugins that Vundle would otherwise try to clone into the same directory. It also provides an additional level of customisation. +The 'pinned' option +------------------- + +A flag that, when set to a value of 1, tells Vundle not to perform any git +operations on the plugin, while still adding the existing plugin under the +`bundles` directories to the |runtimepath|. + +For example: +> + Plugin 'mylocalplugin', {'pinned': 1} + +This allows the users to include, with Vundle, plugins tracked with version +control systems other than git, but the user is responsible for cloning and +keeping up to date. It also allows the users to stay in the current version of +a plugin that might have previously been updated by Vundle. + +Please note that the URI will be treated the same as for any other plugins, so +only the last part of it will be added to the |runtimepath|. The user is +advised to use this flag only with single word URIs to avoid confusion. + 3.2 SUPPORTED URIS ~ *vundle-plugins-uris* @@ -185,7 +205,7 @@ GitHub is used when a user/repo is passed to `Plugin`. Vim Scripts ----------- -Any single word without a '/' is assumed to be from Vim Scripts. +Any single word without a slash '/' is assumed to be from Vim Scripts. > Plugin 'ctrlp.vim' => https://github.com/vim-scripts/ctrlp.vim diff --git a/test/vimrc b/test/vimrc index 13dd2e2..b4f2676 100644 --- a/test/vimrc +++ b/test/vimrc @@ -58,6 +58,13 @@ Bundle 'vim-scripts/RubySinatra' " syntax issue #203 Bundle 'jimenezrick/vimerl' +" Static bundle: Same name as a valid vim-scripts bundle +Bundle 'latte', {'pinned' : 1} +if !isdirectory(expand(bundle_dir) . '/latte') + call mkdir(expand(bundle_dir) . '/latte', 'p') +endif + + filetype plugin indent on " Automatically detect file types. set wildignore+=doc " should not break helptags