mirror of
https://github.com/junegunn/vim-plug.git
synced 2024-12-19 10:35:38 -07:00
Implement g:plug_url_format (#62)
This commit is contained in:
parent
3572ffde79
commit
ab3bd3b17c
13
README.md
13
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
|
||||
|
||||
|
3
plug.vim
3
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 }
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user