diff --git a/README.md b/README.md index 9f0daf6..a707f55 100644 --- a/README.md +++ b/README.md @@ -84,12 +84,13 @@ Reload .vimrc and `:PlugInstall` to install plugins. ### Global options -| Flag | Default | Description | -| ---------------- | ---------------------- | ------------------------------------ | -| `g:plug_window` | `vertical topleft new` | Command to open plug window | -| `g:plug_threads` | 16 | Default number of threads to use | -| `g:plug_timeout` | 60 | Time limit of each task in seconds | -| `g:plug_retries` | 2 | Number of retries in case of timeout | +| Flag | Default | Description | +| ------------------- | --------------------------------- | ------------------------------------ | +| `g:plug_threads` | 16 | Default number of threads to use | +| `g:plug_timeout` | 60 | Time limit of each task in seconds | +| `g:plug_retries` | 2 | Number of retries in case of timeout | +| `g:plug_window` | `vertical topleft new` | Command to open plug window | +| `g:plug_url_format` | 'https://git::@github.com/%s.git' | `printf` format to build repo URL | ### Keybindings diff --git a/plug.vim b/plug.vim index 63de48a..5c36a73 100644 --- a/plug.vim +++ b/plug.vim @@ -379,7 +379,8 @@ function! s:infer_properties(name, repo) if repo !~ '/' let repo = 'vim-scripts/'. repo endif - let uri = 'https://git::@github.com/' . repo . '.git' + let fmt = get(g:, 'plug_url_format', 'https://git::@github.com/%s.git') + let uri = printf(fmt, repo) endif let dir = s:dirpath( fnamemodify(join([g:plug_home, a:name], '/'), ':p') ) return { 'dir': dir, 'uri': uri } diff --git a/test/workflow.vader b/test/workflow.vader index 84aa3ea..e9cc3a1 100644 --- a/test/workflow.vader +++ b/test/workflow.vader @@ -874,11 +874,24 @@ Execute (Open plug window in a new tab): AssertEqual tabnr, tabpagenr() q +********************************************************************** +~ g:plug_url_format +********************************************************************** +Execute (Using g:plug_url_format): + call plug#begin() + let g:plug_url_format = 'git@bitbucket.org:%s.git' + Plug 'junegunn/seoul256.vim' + let g:plug_url_format = 'git@bitsocket.org:%s.git' + Plug 'beauty256' + AssertEqual 'git@bitbucket.org:junegunn/seoul256.vim.git', g:plugs['seoul256.vim'].uri + AssertEqual 'git@bitsocket.org:vim-scripts/beauty256.git', g:plugs['beauty256'].uri + Execute (Cleanup): silent! call system('rm -rf '.temp_plugged) silent! call rename('fzf', 'fzf-staged') silent! unlet g:plugs silent! unlet g:plug_home + silent! unlet g:plug_url_format silent! unlet temp_plugged vader plug basertp save_rtp repo lnum fzf out tabnr silent! delf PlugStatusSorted silent! delf AssertExpect