mirror of
https://github.com/junegunn/vim-plug.git
synced 2025-12-08 18:04:46 +08:00
Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7f1846932 | ||
|
|
abbbe914f0 | ||
|
|
1f4e3eb063 | ||
|
|
2fa2761b99 | ||
|
|
078f32142d | ||
|
|
49c6b781e0 | ||
|
|
f4427b97f1 | ||
|
|
6287ba88d5 | ||
|
|
1bbb7a55e3 | ||
|
|
d1022e948e | ||
|
|
b94607b172 | ||
|
|
6bff19c2a9 | ||
|
|
759103d074 | ||
|
|
b32169ff30 | ||
|
|
3f7344d2cc | ||
|
|
7928057108 | ||
|
|
c66e264d41 | ||
|
|
01e4e9170a | ||
|
|
0662b5f4cc | ||
|
|
a2f1ea481d | ||
|
|
7bad3e7802 | ||
|
|
6575bd65b1 | ||
|
|
5d8c4bfc1f | ||
|
|
c0a83826f9 | ||
|
|
6454158846 | ||
|
|
1f206db965 | ||
|
|
f4381fb748 | ||
|
|
561518fd8c |
23
.travis.yml
23
.travis.yml
@@ -1,12 +1,12 @@
|
|||||||
language: ruby
|
language: ruby
|
||||||
sudo: false
|
sudo: required
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- DEPS=$HOME/deps
|
- DEPS=$HOME/deps
|
||||||
- PATH=$DEPS/bin:$PATH
|
- PATH=$DEPS/bin:$PATH
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- env: ENV=nox
|
- env: ENV=vim72
|
||||||
rvm: 1.8.7
|
rvm: 1.8.7
|
||||||
addons: { apt: { packages: [vim-nox] } }
|
addons: { apt: { packages: [vim-nox] } }
|
||||||
- env: ENV=python
|
- env: ENV=python
|
||||||
@@ -15,18 +15,29 @@ matrix:
|
|||||||
- env: ENV=python3
|
- env: ENV=python3
|
||||||
rvm: 1.8.7
|
rvm: 1.8.7
|
||||||
addons: { apt: { packages: [python3-dev] } }
|
addons: { apt: { packages: [python3-dev] } }
|
||||||
- env: ENV=ruby
|
- env: ENV=ruby18
|
||||||
rvm: 1.8.7
|
rvm: 1.8.7
|
||||||
- env: ENV=ruby
|
- env: ENV=ruby20
|
||||||
rvm: 2.0.0
|
rvm: 2.0.0
|
||||||
|
- env: ENV=neovim
|
||||||
|
- env: ENV=vim8
|
||||||
install: |
|
install: |
|
||||||
git config --global user.email "you@example.com"
|
git config --global user.email "you@example.com"
|
||||||
git config --global user.name "Your Name"
|
git config --global user.name "Your Name"
|
||||||
|
|
||||||
if [ "$ENV" == "nox" ]; then
|
if [ "$ENV" == "vim72" ]; then
|
||||||
mkdir -p ${DEPS}/bin
|
mkdir -p ${DEPS}/bin
|
||||||
ln -s /usr/bin/vim.nox ${DEPS}/bin/vim
|
ln -s /usr/bin/vim.nox ${DEPS}/bin/vim
|
||||||
return
|
return
|
||||||
|
elif [ "$ENV" == "neovim" ]; then
|
||||||
|
# https://github.com/neovim/neovim/wiki/Installing-Neovim
|
||||||
|
sudo apt-get install -y software-properties-common
|
||||||
|
sudo add-apt-repository -y ppa:neovim-ppa/unstable
|
||||||
|
sudo apt-get update -y
|
||||||
|
sudo apt-get install -y neovim
|
||||||
|
mkdir -p ${DEPS}/bin
|
||||||
|
ln -s /usr/bin/nvim ${DEPS}/bin/vim
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
C_OPTS="--prefix=$DEPS --with-features=huge --disable-gui "
|
C_OPTS="--prefix=$DEPS --with-features=huge --disable-gui "
|
||||||
@@ -37,7 +48,7 @@ install: |
|
|||||||
python3)
|
python3)
|
||||||
C_OPTS+=--enable-python3interp
|
C_OPTS+=--enable-python3interp
|
||||||
;;
|
;;
|
||||||
ruby)
|
ruby*)
|
||||||
C_OPTS+=--enable-rubyinterp
|
C_OPTS+=--enable-rubyinterp
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
25
README.md
25
README.md
@@ -10,7 +10,7 @@ A minimalist Vim plugin manager.
|
|||||||
- Easier to setup: Single file. No boilerplate code required.
|
- Easier to setup: Single file. No boilerplate code required.
|
||||||
- Easier to use: Concise, intuitive syntax
|
- Easier to use: Concise, intuitive syntax
|
||||||
- [Super-fast][40/4] parallel installation/update
|
- [Super-fast][40/4] parallel installation/update
|
||||||
(with any of `+python`, `+python3`, `+ruby`, or [Neovim][nv])
|
(with any of `+job`, `+python`, `+python3`, `+ruby`, or [Neovim][nv])
|
||||||
- Creates shallow clones to minimize disk space usage and download time
|
- Creates shallow clones to minimize disk space usage and download time
|
||||||
- On-demand loading for [faster startup time][startup-time]
|
- On-demand loading for [faster startup time][startup-time]
|
||||||
- Can review and rollback updates
|
- Can review and rollback updates
|
||||||
@@ -121,16 +121,16 @@ Reload .vimrc and `:PlugInstall` to install plugins.
|
|||||||
|
|
||||||
### `Plug` options
|
### `Plug` options
|
||||||
|
|
||||||
| Option | Description |
|
| Option | Description |
|
||||||
| ----------------------- | ------------------------------------------------ |
|
| ----------------------- | ----------------------------------------------------------- |
|
||||||
| `branch`/`tag`/`commit` | Branch/tag/commit of the repository to use |
|
| `branch`/`tag`/`commit` | Branch/tag/commit of the repository to use |
|
||||||
| `rtp` | Subdirectory that contains Vim plugin |
|
| `rtp` | Subdirectory that contains Vim plugin |
|
||||||
| `dir` | Custom directory for the plugin |
|
| `dir` | Custom directory for the plugin |
|
||||||
| `as` | Use different name for the plugin |
|
| `as` | Use different name for the plugin |
|
||||||
| `do` | Post-update hook (string or funcref) |
|
| `do` | Post-update hook (string or funcref) |
|
||||||
| `on` | On-demand loading: Commands or `<Plug>`-mappings |
|
| `on` | On-demand loading: Commands, `<Plug>`-mappings, or #autocmds |
|
||||||
| `for` | On-demand loading: File types |
|
| `for` | On-demand loading: File types |
|
||||||
| `frozen` | Do not update unless explicitly specified |
|
| `frozen` | Do not update unless explicitly specified |
|
||||||
|
|
||||||
### Global options
|
### Global options
|
||||||
|
|
||||||
@@ -180,6 +180,9 @@ Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
|
|||||||
" Multiple file types
|
" Multiple file types
|
||||||
Plug 'kovisoft/paredit', { 'for': ['clojure', 'scheme'] }
|
Plug 'kovisoft/paredit', { 'for': ['clojure', 'scheme'] }
|
||||||
|
|
||||||
|
" On autocmd
|
||||||
|
Plug 'SirVer/ultisnips', { 'on': '#InsertEnter' }
|
||||||
|
|
||||||
" On-demand loading on both conditions
|
" On-demand loading on both conditions
|
||||||
Plug 'junegunn/vader.vim', { 'on': 'Vader', 'for': 'vader' }
|
Plug 'junegunn/vader.vim', { 'on': 'Vader', 'for': 'vader' }
|
||||||
|
|
||||||
|
|||||||
284
plug.vim
284
plug.vim
@@ -98,6 +98,7 @@ let s:plug_buf = get(s:, 'plug_buf', -1)
|
|||||||
let s:mac_gui = has('gui_macvim') && has('gui_running')
|
let s:mac_gui = has('gui_macvim') && has('gui_running')
|
||||||
let s:is_win = has('win32') || has('win64')
|
let s:is_win = has('win32') || has('win64')
|
||||||
let s:nvim = has('nvim') && exists('*jobwait') && !s:is_win
|
let s:nvim = has('nvim') && exists('*jobwait') && !s:is_win
|
||||||
|
let s:vim8 = has('patch-8.0.0039') && exists('*job_start')
|
||||||
let s:me = resolve(expand('<sfile>:p'))
|
let s:me = resolve(expand('<sfile>:p'))
|
||||||
let s:base_spec = { 'branch': 'master', 'frozen': 0 }
|
let s:base_spec = { 'branch': 'master', 'frozen': 0 }
|
||||||
let s:TYPE = {
|
let s:TYPE = {
|
||||||
@@ -202,7 +203,9 @@ function! plug#end()
|
|||||||
endif
|
endif
|
||||||
let lod = { 'ft': {}, 'map': {}, 'cmd': {} }
|
let lod = { 'ft': {}, 'map': {}, 'cmd': {} }
|
||||||
|
|
||||||
filetype off
|
if exists('g:did_load_filetypes')
|
||||||
|
filetype off
|
||||||
|
endif
|
||||||
for name in g:plugs_order
|
for name in g:plugs_order
|
||||||
if !has_key(g:plugs, name)
|
if !has_key(g:plugs, name)
|
||||||
continue
|
continue
|
||||||
@@ -226,9 +229,16 @@ function! plug#end()
|
|||||||
call s:assoc(lod.cmd, cmd, name)
|
call s:assoc(lod.cmd, cmd, name)
|
||||||
endif
|
endif
|
||||||
call add(s:triggers[name].cmd, cmd)
|
call add(s:triggers[name].cmd, cmd)
|
||||||
|
elseif cmd[0] == '#' && exists('##'.split(cmd, '#')[0])
|
||||||
|
let tokens = split(cmd, '#')
|
||||||
|
let group = 'Plug/'.name
|
||||||
|
execute 'augroup' group
|
||||||
|
autocmd!
|
||||||
|
execute 'autocmd' tokens[0] get(tokens, 1, '*') printf('call s:lod_autocmd(%s)', string(name))
|
||||||
|
execute 'augroup END'
|
||||||
else
|
else
|
||||||
call s:err('Invalid `on` option: '.cmd.
|
call s:err('Invalid `on` option: '.cmd.
|
||||||
\ '. Should start with an uppercase letter or `<Plug>`.')
|
\ '. Should start with an uppercase letter, `<Plug>`, or `#`.')
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
@@ -256,8 +266,8 @@ function! plug#end()
|
|||||||
for [mode, map_prefix, key_prefix] in
|
for [mode, map_prefix, key_prefix] in
|
||||||
\ [['i', '<C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
|
\ [['i', '<C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
|
||||||
execute printf(
|
execute printf(
|
||||||
\ '%snoremap <silent> %s %s:<C-U>call <SID>lod_map(%s, %s, "%s")<CR>',
|
\ '%snoremap <silent> %s %s:<C-U>call <SID>lod_map(%s, %s, %s, "%s")<CR>',
|
||||||
\ mode, map, map_prefix, string(map), string(names), key_prefix)
|
\ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix)
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
@@ -398,7 +408,7 @@ function! s:reorg_rtp()
|
|||||||
|
|
||||||
let s:middle = get(s:, 'middle', &rtp)
|
let s:middle = get(s:, 'middle', &rtp)
|
||||||
let rtps = map(s:loaded_names(), 's:rtp(g:plugs[v:val])')
|
let rtps = map(s:loaded_names(), 's:rtp(g:plugs[v:val])')
|
||||||
let afters = filter(map(copy(rtps), 'globpath(v:val, "after")'), 'isdirectory(v:val)')
|
let afters = filter(map(copy(rtps), 'globpath(v:val, "after")'), '!empty(v:val)')
|
||||||
let rtp = join(map(rtps, 'escape(v:val, ",")'), ',')
|
let rtp = join(map(rtps, 'escape(v:val, ",")'), ',')
|
||||||
\ . ','.s:middle.','
|
\ . ','.s:middle.','
|
||||||
\ . join(map(afters, 'escape(v:val, ",")'), ',')
|
\ . join(map(afters, 'escape(v:val, ",")'), ',')
|
||||||
@@ -440,9 +450,7 @@ function! plug#load(...)
|
|||||||
let s = len(unknowns) > 1 ? 's' : ''
|
let s = len(unknowns) > 1 ? 's' : ''
|
||||||
return s:err(printf('Unknown plugin%s: %s', s, join(unknowns, ', ')))
|
return s:err(printf('Unknown plugin%s: %s', s, join(unknowns, ', ')))
|
||||||
end
|
end
|
||||||
for name in a:000
|
call s:lod(a:000, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
||||||
call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
|
||||||
endfor
|
|
||||||
call s:dobufread(a:000)
|
call s:dobufread(a:000)
|
||||||
return 1
|
return 1
|
||||||
endfunction
|
endfunction
|
||||||
@@ -497,7 +505,7 @@ function! s:lod_cmd(cmd, bang, l1, l2, args, names)
|
|||||||
execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
|
execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:lod_map(map, names, prefix)
|
function! s:lod_map(map, names, with_prefix, prefix)
|
||||||
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
||||||
call s:dobufread(a:names)
|
call s:dobufread(a:names)
|
||||||
let extra = ''
|
let extra = ''
|
||||||
@@ -508,14 +516,27 @@ function! s:lod_map(map, names, prefix)
|
|||||||
endif
|
endif
|
||||||
let extra .= nr2char(c)
|
let extra .= nr2char(c)
|
||||||
endwhile
|
endwhile
|
||||||
if v:count
|
|
||||||
call feedkeys(v:count, 'n')
|
if a:with_prefix
|
||||||
|
let prefix = v:count ? v:count : ''
|
||||||
|
let prefix .= '"'.v:register.a:prefix
|
||||||
|
if mode(1) == 'no'
|
||||||
|
if v:operator == 'c'
|
||||||
|
let prefix = "\<esc>" . prefix
|
||||||
|
endif
|
||||||
|
let prefix .= v:operator
|
||||||
|
endif
|
||||||
|
call feedkeys(prefix, 'n')
|
||||||
endif
|
endif
|
||||||
call feedkeys('"'.v:register, 'n')
|
call feedkeys(substitute(a:map, '^<Plug>', "\<Plug>", '') . extra)
|
||||||
if mode(1) == 'no'
|
endfunction
|
||||||
call feedkeys(v:operator)
|
|
||||||
endif
|
function! s:lod_autocmd(name)
|
||||||
call feedkeys(a:prefix . substitute(a:map, '^<Plug>', "\<Plug>", '') . extra)
|
call s:lod([a:name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
||||||
|
call s:dobufread([a:name])
|
||||||
|
let group = 'Plug/'.a:name
|
||||||
|
execute 'autocmd!' group
|
||||||
|
execute 'augroup!' group
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! plug#(repo, ...)
|
function! plug#(repo, ...)
|
||||||
@@ -568,8 +589,7 @@ function! s:infer_properties(name, repo)
|
|||||||
let fmt = get(g:, 'plug_url_format', 'https://git::@github.com/%s.git')
|
let fmt = get(g:, 'plug_url_format', 'https://git::@github.com/%s.git')
|
||||||
let uri = printf(fmt, repo)
|
let uri = printf(fmt, repo)
|
||||||
endif
|
endif
|
||||||
let dir = s:dirpath( fnamemodify(join([g:plug_home, a:name], '/'), ':p') )
|
return { 'dir': s:dirpath(g:plug_home.'/'.a:name), 'uri': uri }
|
||||||
return { 'dir': dir, 'uri': uri }
|
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -723,10 +743,14 @@ function! s:prepare(...)
|
|||||||
|
|
||||||
call s:job_abort()
|
call s:job_abort()
|
||||||
if s:switch_in()
|
if s:switch_in()
|
||||||
normal q
|
if b:plug_preview == 1
|
||||||
|
pc
|
||||||
|
endif
|
||||||
|
enew
|
||||||
|
else
|
||||||
|
call s:new_window()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call s:new_window()
|
|
||||||
nnoremap <silent> <buffer> q :if b:plug_preview==1<bar>pc<bar>endif<bar>bd<cr>
|
nnoremap <silent> <buffer> q :if b:plug_preview==1<bar>pc<bar>endif<bar>bd<cr>
|
||||||
if a:0 == 0
|
if a:0 == 0
|
||||||
call s:finish_bindings()
|
call s:finish_bindings()
|
||||||
@@ -739,7 +763,7 @@ function! s:prepare(...)
|
|||||||
for k in ['<cr>', 'L', 'o', 'X', 'd', 'dd']
|
for k in ['<cr>', 'L', 'o', 'X', 'd', 'dd']
|
||||||
execute 'silent! unmap <buffer>' k
|
execute 'silent! unmap <buffer>' k
|
||||||
endfor
|
endfor
|
||||||
setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap cursorline modifiable
|
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline modifiable
|
||||||
setf vim-plug
|
setf vim-plug
|
||||||
if exists('g:syntax_on')
|
if exists('g:syntax_on')
|
||||||
call s:syntax()
|
call s:syntax()
|
||||||
@@ -806,7 +830,15 @@ function! s:do(pull, force, todo)
|
|||||||
if type == s:TYPE.string
|
if type == s:TYPE.string
|
||||||
if spec.do[0] == ':'
|
if spec.do[0] == ':'
|
||||||
call s:load_plugin(spec)
|
call s:load_plugin(spec)
|
||||||
execute spec.do[1:]
|
try
|
||||||
|
execute spec.do[1:]
|
||||||
|
catch
|
||||||
|
let error = v:exception
|
||||||
|
endtry
|
||||||
|
if !s:plug_window_exists()
|
||||||
|
cd -
|
||||||
|
throw 'Warning: vim-plug was terminated by the post-update hook of '.name
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
let error = s:bang(spec.do)
|
let error = s:bang(spec.do)
|
||||||
endif
|
endif
|
||||||
@@ -933,8 +965,9 @@ function! s:update_impl(pull, force, args) abort
|
|||||||
call s:warn('echom', '[vim-plug] Update Neovim for parallel installer')
|
call s:warn('echom', '[vim-plug] Update Neovim for parallel installer')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let python = (has('python') || has('python3')) && (!s:nvim || has('vim_starting'))
|
let use_job = s:nvim || s:vim8
|
||||||
let ruby = has('ruby') && !s:nvim && (v:version >= 703 || v:version == 702 && has('patch374')) && !(s:is_win && has('gui_running')) && s:check_ruby()
|
let python = (has('python') || has('python3')) && !use_job
|
||||||
|
let ruby = has('ruby') && !use_job && (v:version >= 703 || v:version == 702 && has('patch374')) && !(s:is_win && has('gui_running')) && s:check_ruby()
|
||||||
|
|
||||||
let s:update = {
|
let s:update = {
|
||||||
\ 'start': reltime(),
|
\ 'start': reltime(),
|
||||||
@@ -944,7 +977,7 @@ function! s:update_impl(pull, force, args) abort
|
|||||||
\ 'pull': a:pull,
|
\ 'pull': a:pull,
|
||||||
\ 'force': a:force,
|
\ 'force': a:force,
|
||||||
\ 'new': {},
|
\ 'new': {},
|
||||||
\ 'threads': (python || ruby || s:nvim) ? min([len(todo), threads]) : 1,
|
\ 'threads': (python || ruby || use_job) ? min([len(todo), threads]) : 1,
|
||||||
\ 'bar': '',
|
\ 'bar': '',
|
||||||
\ 'fin': 0
|
\ 'fin': 0
|
||||||
\ }
|
\ }
|
||||||
@@ -958,7 +991,7 @@ function! s:update_impl(pull, force, args) abort
|
|||||||
\ '--depth 1' . (s:git_version_requirement(1, 7, 10) ? ' --no-single-branch' : '') : ''
|
\ '--depth 1' . (s:git_version_requirement(1, 7, 10) ? ' --no-single-branch' : '') : ''
|
||||||
|
|
||||||
" Python version requirement (>= 2.7)
|
" Python version requirement (>= 2.7)
|
||||||
if python && !has('python3') && !ruby && !s:nvim && s:update.threads > 1
|
if python && !has('python3') && !ruby && !use_job && s:update.threads > 1
|
||||||
redir => pyv
|
redir => pyv
|
||||||
silent python import platform; print platform.python_version()
|
silent python import platform; print platform.python_version()
|
||||||
redir END
|
redir END
|
||||||
@@ -999,6 +1032,12 @@ function! s:update_impl(pull, force, args) abort
|
|||||||
endtry
|
endtry
|
||||||
else
|
else
|
||||||
call s:update_vim()
|
call s:update_vim()
|
||||||
|
while use_job && has('vim_starting')
|
||||||
|
sleep 100m
|
||||||
|
if s:update.fin
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -1014,7 +1053,7 @@ function! s:update_finish()
|
|||||||
if s:switch_in()
|
if s:switch_in()
|
||||||
call append(3, '- Updating ...') | 4
|
call append(3, '- Updating ...') | 4
|
||||||
for [name, spec] in items(filter(copy(s:update.all), 'index(s:update.errors, v:key) < 0 && (s:update.force || s:update.pull || has_key(s:update.new, v:key))'))
|
for [name, spec] in items(filter(copy(s:update.all), 'index(s:update.errors, v:key) < 0 && (s:update.force || s:update.pull || has_key(s:update.new, v:key))'))
|
||||||
let pos = s:logpos(name)
|
let [pos, _] = s:logpos(name)
|
||||||
if !pos
|
if !pos
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
@@ -1044,19 +1083,25 @@ function! s:update_finish()
|
|||||||
call s:log4(name, 'Updating submodules. This may take a while.')
|
call s:log4(name, 'Updating submodules. This may take a while.')
|
||||||
let out .= s:bang('git submodule update --init --recursive 2>&1', spec.dir)
|
let out .= s:bang('git submodule update --init --recursive 2>&1', spec.dir)
|
||||||
endif
|
endif
|
||||||
let msg = printf('%s %s: %s', v:shell_error ? 'x': '-', name, s:lastline(out))
|
let msg = s:format_message(v:shell_error ? 'x': '-', name, out)
|
||||||
if v:shell_error
|
if v:shell_error
|
||||||
call add(s:update.errors, name)
|
call add(s:update.errors, name)
|
||||||
call s:regress_bar()
|
call s:regress_bar()
|
||||||
silent execute pos 'd _'
|
silent execute pos 'd _'
|
||||||
call append(4, msg) | 4
|
call append(4, msg) | 4
|
||||||
elseif !empty(out)
|
elseif !empty(out)
|
||||||
call setline(pos, msg)
|
call setline(pos, msg[0])
|
||||||
endif
|
endif
|
||||||
redraw
|
redraw
|
||||||
endfor
|
endfor
|
||||||
silent 4 d _
|
silent 4 d _
|
||||||
call s:do(s:update.pull, s:update.force, filter(copy(s:update.all), 'index(s:update.errors, v:key) < 0 && has_key(v:val, "do")'))
|
try
|
||||||
|
call s:do(s:update.pull, s:update.force, filter(copy(s:update.all), 'index(s:update.errors, v:key) < 0 && has_key(v:val, "do")'))
|
||||||
|
catch
|
||||||
|
call s:warn('echom', v:exception)
|
||||||
|
call s:warn('echo', '')
|
||||||
|
return
|
||||||
|
endtry
|
||||||
call s:finish(s:update.pull)
|
call s:finish(s:update.pull)
|
||||||
call setline(1, 'Updated. Elapsed time: ' . split(reltimestr(reltime(s:update.start)))[0] . ' sec.')
|
call setline(1, 'Updated. Elapsed time: ' . split(reltimestr(reltime(s:update.start)))[0] . ' sec.')
|
||||||
call s:switch_out('normal! gg')
|
call s:switch_out('normal! gg')
|
||||||
@@ -1064,12 +1109,16 @@ function! s:update_finish()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:job_abort()
|
function! s:job_abort()
|
||||||
if !s:nvim || !exists('s:jobs')
|
if (!s:nvim && !s:vim8) || !exists('s:jobs')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
for [name, j] in items(s:jobs)
|
for [name, j] in items(s:jobs)
|
||||||
silent! call jobstop(j.jobid)
|
if s:nvim
|
||||||
|
silent! call jobstop(j.jobid)
|
||||||
|
elseif s:vim8
|
||||||
|
silent! call job_stop(j.jobid)
|
||||||
|
endif
|
||||||
if j.new
|
if j.new
|
||||||
call s:system('rm -rf ' . s:shellesc(g:plugs[name].dir))
|
call s:system('rm -rf ' . s:shellesc(g:plugs[name].dir))
|
||||||
endif
|
endif
|
||||||
@@ -1077,59 +1126,88 @@ function! s:job_abort()
|
|||||||
let s:jobs = {}
|
let s:jobs = {}
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" When a:event == 'stdout', data = list of strings
|
function! s:last_non_empty_line(lines)
|
||||||
" When a:event == 'exit', data = returncode
|
let len = len(a:lines)
|
||||||
function! s:job_handler(job_id, data, event) abort
|
for idx in range(len)
|
||||||
if !s:plug_window_exists() " plug window closed
|
let line = a:lines[len-idx-1]
|
||||||
return s:job_abort()
|
if !empty(line)
|
||||||
endif
|
return line
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
if a:event == 'stdout'
|
function! s:job_out_cb(self, data) abort
|
||||||
let complete = empty(a:data[-1])
|
let self = a:self
|
||||||
let lines = map(filter(a:data, 'len(v:val) > 0'), 'split(v:val, "[\r\n]")[-1]')
|
let data = remove(self.lines, -1) . a:data
|
||||||
call extend(self.lines, lines)
|
let lines = map(split(data, "\n", 1), 'split(v:val, "\r", 1)[-1]')
|
||||||
let self.result = join(self.lines, "\n")
|
call extend(self.lines, lines)
|
||||||
if !complete
|
" To reduce the number of buffer updates
|
||||||
call remove(self.lines, -1)
|
let self.tick = get(self, 'tick', -1) + 1
|
||||||
endif
|
if !self.running || self.tick % len(s:jobs) == 0
|
||||||
" To reduce the number of buffer updates
|
let bullet = self.running ? (self.new ? '+' : '*') : (self.error ? 'x' : '-')
|
||||||
let self.tick = get(self, 'tick', -1) + 1
|
let result = self.error ? join(self.lines, "\n") : s:last_non_empty_line(self.lines)
|
||||||
if self.tick % len(s:jobs) == 0
|
call s:log(bullet, self.name, result)
|
||||||
call s:log(self.new ? '+' : '*', self.name, self.result)
|
|
||||||
endif
|
|
||||||
elseif a:event == 'exit'
|
|
||||||
let self.running = 0
|
|
||||||
if a:data != 0
|
|
||||||
let self.error = 1
|
|
||||||
endif
|
|
||||||
call s:reap(self.name)
|
|
||||||
call s:tick()
|
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:job_exit_cb(self, data) abort
|
||||||
|
let a:self.running = 0
|
||||||
|
let a:self.error = a:data != 0
|
||||||
|
call s:reap(a:self.name)
|
||||||
|
call s:tick()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:job_cb(fn, job, ch, data)
|
||||||
|
if !s:plug_window_exists() " plug window closed
|
||||||
|
return s:job_abort()
|
||||||
|
endif
|
||||||
|
call call(a:fn, [a:job, a:data])
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:nvim_cb(job_id, data, event) abort
|
||||||
|
return a:event == 'stdout' ?
|
||||||
|
\ s:job_cb('s:job_out_cb', self, 0, join(a:data, "\n")) :
|
||||||
|
\ s:job_cb('s:job_exit_cb', self, 0, a:data)
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:spawn(name, cmd, opts)
|
function! s:spawn(name, cmd, opts)
|
||||||
let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [], 'result': '',
|
let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''],
|
||||||
\ 'new': get(a:opts, 'new', 0),
|
\ 'new': get(a:opts, 'new', 0) }
|
||||||
\ 'on_stdout': function('s:job_handler'),
|
|
||||||
\ 'on_exit' : function('s:job_handler'),
|
|
||||||
\ }
|
|
||||||
let s:jobs[a:name] = job
|
let s:jobs[a:name] = job
|
||||||
|
let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'],
|
||||||
|
\ has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd)
|
||||||
|
|
||||||
if s:nvim
|
if s:nvim
|
||||||
let argv = [ 'sh', '-c',
|
call extend(job, {
|
||||||
\ (has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd) ]
|
\ 'on_stdout': function('s:nvim_cb'),
|
||||||
|
\ 'on_exit': function('s:nvim_cb'),
|
||||||
|
\ })
|
||||||
let jid = jobstart(argv, job)
|
let jid = jobstart(argv, job)
|
||||||
if jid > 0
|
if jid > 0
|
||||||
let job.jobid = jid
|
let job.jobid = jid
|
||||||
else
|
else
|
||||||
let job.running = 0
|
let job.running = 0
|
||||||
let job.error = 1
|
let job.error = 1
|
||||||
let job.result = jid < 0 ? 'sh is not executable' :
|
let job.lines = [jid < 0 ? argv[0].' is not executable' :
|
||||||
\ 'Invalid arguments (or job table is full)'
|
\ 'Invalid arguments (or job table is full)']
|
||||||
|
endif
|
||||||
|
elseif s:vim8
|
||||||
|
let jid = job_start(argv, {
|
||||||
|
\ 'out_cb': function('s:job_cb', ['s:job_out_cb', job]),
|
||||||
|
\ 'exit_cb': function('s:job_cb', ['s:job_exit_cb', job]),
|
||||||
|
\ 'out_mode': 'raw'
|
||||||
|
\})
|
||||||
|
if job_status(jid) == 'run'
|
||||||
|
let job.jobid = jid
|
||||||
|
else
|
||||||
|
let job.running = 0
|
||||||
|
let job.error = 1
|
||||||
|
let job.lines = ['Failed to start job']
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let params = has_key(a:opts, 'dir') ? [a:cmd, a:opts.dir] : [a:cmd]
|
let params = has_key(a:opts, 'dir') ? [a:cmd, a:opts.dir] : [a:cmd]
|
||||||
let job.result = call('s:system', params)
|
let job.lines = s:lines(call('s:system', params))
|
||||||
let job.error = v:shell_error != 0
|
let job.error = v:shell_error != 0
|
||||||
let job.running = 0
|
let job.running = 0
|
||||||
endif
|
endif
|
||||||
@@ -1144,7 +1222,9 @@ function! s:reap(name)
|
|||||||
endif
|
endif
|
||||||
let s:update.bar .= job.error ? 'x' : '='
|
let s:update.bar .= job.error ? 'x' : '='
|
||||||
|
|
||||||
call s:log(job.error ? 'x' : '-', a:name, empty(job.result) ? 'OK' : job.result)
|
let bullet = job.error ? 'x' : '-'
|
||||||
|
let result = job.error ? join(job.lines, "\n") : s:last_non_empty_line(job.lines)
|
||||||
|
call s:log(bullet, a:name, empty(result) ? 'OK' : result)
|
||||||
call s:bar()
|
call s:bar()
|
||||||
|
|
||||||
call remove(s:jobs, a:name)
|
call remove(s:jobs, a:name)
|
||||||
@@ -1163,23 +1243,31 @@ endfunction
|
|||||||
function! s:logpos(name)
|
function! s:logpos(name)
|
||||||
for i in range(4, line('$'))
|
for i in range(4, line('$'))
|
||||||
if getline(i) =~# '^[-+x*] '.a:name.':'
|
if getline(i) =~# '^[-+x*] '.a:name.':'
|
||||||
return i
|
for j in range(i + 1, line('$'))
|
||||||
|
if getline(j) !~ '^ '
|
||||||
|
return [i, j - 1]
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return [i, i]
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
return [0, 0]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:log(bullet, name, lines)
|
function! s:log(bullet, name, lines)
|
||||||
if s:switch_in()
|
if s:switch_in()
|
||||||
let pos = s:logpos(a:name)
|
let [b, e] = s:logpos(a:name)
|
||||||
if pos > 0
|
if b > 0
|
||||||
silent execute pos 'd _'
|
silent execute printf('%d,%d d _', b, e)
|
||||||
if pos > winheight('.')
|
if b > winheight('.')
|
||||||
let pos = 4
|
let b = 4
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let pos = 4
|
let b = 4
|
||||||
endif
|
endif
|
||||||
call append(pos - 1, s:format_message(a:bullet, a:name, a:lines))
|
" FIXME For some reason, nomodifiable is set after :d in vim8
|
||||||
|
setlocal modifiable
|
||||||
|
call append(b - 1, s:format_message(a:bullet, a:name, a:lines))
|
||||||
call s:switch_out()
|
call s:switch_out()
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@@ -1193,12 +1281,12 @@ endfunction
|
|||||||
|
|
||||||
function! s:tick()
|
function! s:tick()
|
||||||
let pull = s:update.pull
|
let pull = s:update.pull
|
||||||
let prog = s:progress_opt(s:nvim)
|
let prog = s:progress_opt(s:nvim || s:vim8)
|
||||||
while 1 " Without TCO, Vim stack is bound to explode
|
while 1 " Without TCO, Vim stack is bound to explode
|
||||||
if empty(s:update.todo)
|
if empty(s:update.todo)
|
||||||
if empty(s:jobs) && !s:update.fin
|
if empty(s:jobs) && !s:update.fin
|
||||||
let s:update.fin = 1
|
|
||||||
call s:update_finish()
|
call s:update_finish()
|
||||||
|
let s:update.fin = 1
|
||||||
endif
|
endif
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@@ -1218,10 +1306,10 @@ while 1 " Without TCO, Vim stack is bound to explode
|
|||||||
let fetch_opt = (has_tag && !empty(globpath(spec.dir, '.git/shallow'))) ? '--depth 99999999' : ''
|
let fetch_opt = (has_tag && !empty(globpath(spec.dir, '.git/shallow'))) ? '--depth 99999999' : ''
|
||||||
call s:spawn(name, printf('git fetch %s %s 2>&1', fetch_opt, prog), { 'dir': spec.dir })
|
call s:spawn(name, printf('git fetch %s %s 2>&1', fetch_opt, prog), { 'dir': spec.dir })
|
||||||
else
|
else
|
||||||
let s:jobs[name] = { 'running': 0, 'result': 'Already installed', 'error': 0 }
|
let s:jobs[name] = { 'running': 0, 'lines': ['Already installed'], 'error': 0 }
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let s:jobs[name] = { 'running': 0, 'result': error, 'error': 1 }
|
let s:jobs[name] = { 'running': 0, 'lines': s:lines(error), 'error': 1 }
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
call s:spawn(name,
|
call s:spawn(name,
|
||||||
@@ -1507,10 +1595,12 @@ class Plugin(object):
|
|||||||
return result[-1]
|
return result[-1]
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
match = re.compile(r'git::?@')
|
actual_uri = self.repo_uri()
|
||||||
actual_uri = re.sub(match, '', self.repo_uri())
|
expect_uri = self.args['uri']
|
||||||
expect_uri = re.sub(match, '', self.args['uri'])
|
regex = re.compile(r'^(?:\w+://)?(?:[^@/]*@)?([^:/]*(?::[0-9]*)?)[:/](.*?)(?:\.git)?/?$')
|
||||||
if actual_uri != expect_uri:
|
ma = regex.match(actual_uri)
|
||||||
|
mb = regex.match(expect_uri)
|
||||||
|
if ma is None or mb is None or ma.groups() != mb.groups():
|
||||||
msg = ['',
|
msg = ['',
|
||||||
'Invalid URI: {0}'.format(actual_uri),
|
'Invalid URI: {0}'.format(actual_uri),
|
||||||
'Expected {0}'.format(expect_uri),
|
'Expected {0}'.format(expect_uri),
|
||||||
@@ -1669,6 +1759,11 @@ function! s:update_ruby()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def compare_git_uri a, b
|
||||||
|
regex = %r{^(?:\w+://)?(?:[^@/]*@)?([^:/]*(?::[0-9]*)?)[:/](.*?)(?:\.git)?/?$}
|
||||||
|
regex.match(a).to_a.drop(1) == regex.match(b).to_a.drop(1)
|
||||||
|
end
|
||||||
|
|
||||||
require 'thread'
|
require 'thread'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
require 'timeout'
|
require 'timeout'
|
||||||
@@ -1770,9 +1865,8 @@ function! s:update_ruby()
|
|||||||
main = Thread.current
|
main = Thread.current
|
||||||
threads = []
|
threads = []
|
||||||
watcher = Thread.new {
|
watcher = Thread.new {
|
||||||
while VIM::evaluate('getchar(1)')
|
require 'io/console' # >= Ruby 1.9
|
||||||
sleep 0.1
|
nil until IO.console.getch == 3.chr
|
||||||
end
|
|
||||||
mtx.synchronize do
|
mtx.synchronize do
|
||||||
running = false
|
running = false
|
||||||
threads.each { |t| t.raise Interrupt }
|
threads.each { |t| t.raise Interrupt }
|
||||||
@@ -1810,7 +1904,7 @@ function! s:update_ruby()
|
|||||||
else
|
else
|
||||||
[false, [data.chomp, "PlugClean required."].join($/)]
|
[false, [data.chomp, "PlugClean required."].join($/)]
|
||||||
end
|
end
|
||||||
elsif current_uri.sub(/git::?@/, '') != uri.sub(/git::?@/, '')
|
elsif !compare_git_uri(current_uri, uri)
|
||||||
[false, ["Invalid URI: #{current_uri}",
|
[false, ["Invalid URI: #{current_uri}",
|
||||||
"Expected: #{uri}",
|
"Expected: #{uri}",
|
||||||
"PlugClean required."].join($/)]
|
"PlugClean required."].join($/)]
|
||||||
@@ -1856,9 +1950,15 @@ function! s:progress_bar(line, bar, total)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:compare_git_uri(a, b)
|
function! s:compare_git_uri(a, b)
|
||||||
let a = substitute(a:a, 'git:\{1,2}@', '', '')
|
" See `git help clone'
|
||||||
let b = substitute(a:b, 'git:\{1,2}@', '', '')
|
" https:// [user@] github.com[:port] / junegunn/vim-plug [.git]
|
||||||
return a ==# b
|
" [git@] github.com[:port] : junegunn/vim-plug [.git]
|
||||||
|
" file:// / junegunn/vim-plug [/]
|
||||||
|
" / junegunn/vim-plug [/]
|
||||||
|
let pat = '^\%(\w\+://\)\='.'\%([^@/]*@\)\='.'\([^:/]*\%(:[0-9]*\)\=\)'.'[:/]'.'\(.\{-}\)'.'\%(\.git\)\=/\?$'
|
||||||
|
let ma = matchlist(a:a, pat)
|
||||||
|
let mb = matchlist(a:b, pat)
|
||||||
|
return ma[1:2] ==# mb[1:2]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:format_message(bullet, name, message)
|
function! s:format_message(bullet, name, message)
|
||||||
|
|||||||
@@ -14,8 +14,15 @@ Execute (Initialize test environment):
|
|||||||
|
|
||||||
" Temporarily patch plug.vim
|
" Temporarily patch plug.vim
|
||||||
call system('cp "$PLUG_SRC" "$PLUG_TMP"')
|
call system('cp "$PLUG_SRC" "$PLUG_TMP"')
|
||||||
call writefile(extend(readfile($PLUG_TMP),
|
let patch =
|
||||||
\ ['function! ResetPlug()', 'let s:loaded = {}', 'endfunction']), $PLUG_TMP)
|
\ ['function! ResetPlug()', 'let s:loaded = {}', 'endfunction',
|
||||||
|
\ 'function! CompareURI(a, b)', 'return s:compare_git_uri(a:a, a:b)', 'endfunction']
|
||||||
|
|
||||||
|
if $ENV != 'vim8'
|
||||||
|
call add(patch, 'let s:vim8 = 0')
|
||||||
|
endif
|
||||||
|
|
||||||
|
call writefile(extend(readfile($PLUG_TMP), patch), $PLUG_TMP)
|
||||||
|
|
||||||
set t_Co=256
|
set t_Co=256
|
||||||
colo default
|
colo default
|
||||||
@@ -69,14 +76,16 @@ Execute (Initialize test environment):
|
|||||||
Execute (Print Interpreter Version):
|
Execute (Print Interpreter Version):
|
||||||
redir => out
|
redir => out
|
||||||
if has('ruby')
|
if has('ruby')
|
||||||
silent ruby puts 'Ruby: ' + RUBY_VERSION
|
silent! ruby puts 'Ruby: ' + RUBY_VERSION
|
||||||
elseif has('python')
|
endif
|
||||||
silent python import sys; svi = sys.version_info; print 'Python: {}.{}.{}'.format(svi[0], svi[1], svi[2])
|
if has('python')
|
||||||
elseif has('python3')
|
silent! python import sys; svi = sys.version_info; print 'Python: {}.{}.{}'.format(svi[0], svi[1], svi[2])
|
||||||
silent python3 import sys; svi = sys.version_info; print('Python: {}.{}.{}'.format(svi[0], svi[1], svi[2]))
|
endif
|
||||||
|
if has('python3')
|
||||||
|
silent! python3 import sys; svi = sys.version_info; print('Python: {}.{}.{}'.format(svi[0], svi[1], svi[2]))
|
||||||
endif
|
endif
|
||||||
redir END
|
redir END
|
||||||
Log substitute(out, '\n', '', 'g')
|
Log split(out, '\n')
|
||||||
|
|
||||||
Include: workflow.vader
|
Include: workflow.vader
|
||||||
Include: regressions.vader
|
Include: regressions.vader
|
||||||
|
|||||||
@@ -959,6 +959,27 @@ Execute (Vim command with : prefix):
|
|||||||
AssertEqual '12345', getline(2)
|
AssertEqual '12345', getline(2)
|
||||||
q
|
q
|
||||||
|
|
||||||
|
Execute (Vim command with : prefix closing the window):
|
||||||
|
call plug#begin()
|
||||||
|
Plug 'junegunn/vim-pseudocl', { 'do': ':close' }
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
redir => out
|
||||||
|
PlugInstall!
|
||||||
|
redir END
|
||||||
|
Assert out =~ 'vim-plug was terminated'
|
||||||
|
Assert out =~ 'of vim-pseudocl'
|
||||||
|
|
||||||
|
Execute (Invalid vim command in post-update hook):
|
||||||
|
call plug#begin()
|
||||||
|
Plug 'junegunn/vim-pseudocl', { 'do': ':nosuchcommand' }
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
PlugInstall!
|
||||||
|
Log getline(1, '$')
|
||||||
|
AssertExpect! 'x Post-update hook for vim-pseudocl ... Vim:E492: Not an editor command: nosuchcommand', 1
|
||||||
|
q
|
||||||
|
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
~ Overriding `dir`
|
~ Overriding `dir`
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
@@ -1397,8 +1418,9 @@ Execute (Commit hash support):
|
|||||||
call plug#end()
|
call plug#end()
|
||||||
PlugUpdate
|
PlugUpdate
|
||||||
Log getline(1, '$')
|
Log getline(1, '$')
|
||||||
AssertEqual 'x goyo.vim: error: pathspec ''ffffffff'' did not match any file(s) known to git.', getline(5)
|
AssertEqual 'x goyo.vim:', getline(5)
|
||||||
AssertEqual 0, stridx(getline(6), '- vim-emoji: HEAD is now at 9db7fcf...')
|
AssertEqual ' error: pathspec ''ffffffff'' did not match any file(s) known to git.', getline(6)
|
||||||
|
AssertEqual 0, stridx(getline(7), '- vim-emoji: HEAD is now at 9db7fcf...')
|
||||||
|
|
||||||
let hash = system(printf('cd %s && git rev-parse HEAD', g:plugs['vim-emoji'].dir))[:-2]
|
let hash = system(printf('cd %s && git rev-parse HEAD', g:plugs['vim-emoji'].dir))[:-2]
|
||||||
AssertEqual '9db7fcfee0d90dafdbcb7a32090c0a9085eb054a', hash
|
AssertEqual '9db7fcfee0d90dafdbcb7a32090c0a9085eb054a', hash
|
||||||
@@ -1471,3 +1493,57 @@ Execute (#427 - Tag option with wildcard (requires git 1.9.2 or above)):
|
|||||||
q
|
q
|
||||||
AssertEqual '2.9.7', GitTag('vim-easy-align')
|
AssertEqual '2.9.7', GitTag('vim-easy-align')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Execute (#530 - Comparison of compatible git URIs):
|
||||||
|
" .git suffix
|
||||||
|
Assert CompareURI('https://github.com/junegunn/vim-plug.git', 'https://github.com/junegunn/vim-plug')
|
||||||
|
|
||||||
|
" user@
|
||||||
|
Assert CompareURI('https://github.com/junegunn/vim-plug.git', 'https://user@github.com/junegunn/vim-plug.git')
|
||||||
|
|
||||||
|
" git::@
|
||||||
|
Assert CompareURI('https://github.com/junegunn/vim-plug.git', 'https://git::@github.com/junegunn/vim-plug.git')
|
||||||
|
|
||||||
|
" https and ssh
|
||||||
|
Assert CompareURI('https://github.com/junegunn/vim-plug.git', 'git@github.com:junegunn/vim-plug.git')
|
||||||
|
|
||||||
|
" file://
|
||||||
|
Assert CompareURI('file:///tmp/vim-plug', '/tmp/vim-plug')
|
||||||
|
Assert CompareURI('file:///tmp/vim-plug', '/tmp/vim-plug/')
|
||||||
|
|
||||||
|
Execute (#530 - Comparison of incompatible git URIs):
|
||||||
|
" Different hostname
|
||||||
|
Assert !CompareURI('https://github.com/junegunn/vim-plug.git', 'https://bitbucket.com/junegunn/vim-plug.git')
|
||||||
|
|
||||||
|
" Different repository
|
||||||
|
Assert !CompareURI('https://github.com/junegunn/vim-plug.git', 'https://github.com/junegunn/emacs-plug.git')
|
||||||
|
|
||||||
|
" Different port
|
||||||
|
Assert !CompareURI('https://github.com/junegunn/vim-plug.git', 'https://github.com:12345/junegunn/vim-plug.git')
|
||||||
|
|
||||||
|
Execute (#532 - Reuse plug window):
|
||||||
|
call plug#begin()
|
||||||
|
Plug 'junegunn/goyo.vim'
|
||||||
|
call plug#end()
|
||||||
|
PlugInstall
|
||||||
|
call system(printf('cd "%s" && git commit --allow-empty -m "dummy"', g:plugs['goyo.vim'].dir))
|
||||||
|
|
||||||
|
PlugDiff
|
||||||
|
AssertEqual 1, winnr()
|
||||||
|
AssertEqual 2, winnr('$')
|
||||||
|
|
||||||
|
" Open preview window
|
||||||
|
execute "normal ]]jo"
|
||||||
|
AssertEqual 2, winnr()
|
||||||
|
AssertEqual 3, winnr('$')
|
||||||
|
|
||||||
|
" Move plug window to the right
|
||||||
|
wincmd L
|
||||||
|
AssertEqual 3, winnr()
|
||||||
|
AssertEqual 3, winnr('$')
|
||||||
|
|
||||||
|
" Reuse plug window. Preview window is closed.
|
||||||
|
PlugStatus
|
||||||
|
AssertEqual 2, winnr()
|
||||||
|
AssertEqual 2, winnr('$')
|
||||||
|
q
|
||||||
|
|||||||
Reference in New Issue
Block a user