35 Commits
0.3.0 ... 0.3.6

Author SHA1 Message Date
Junegunn Choi
c3cf35abb5 Ignore occasional error from Ruby 1.8.7
Related: https://bugs.ruby-lang.org/issues/1471
2014-07-13 22:02:11 +09:00
Junegunn Choi
344f80aedb Fix Ruby installer for Ruby 1.8.7 (#31) 2014-07-13 20:18:56 +09:00
Junegunn Choi
dae0540a11 Change gif 2014-07-13 17:39:19 +09:00
Junegunn Choi
af89938633 Real-time progress report
This commit is almost identical to the reverted
60b907c87f, but it tries to avoid high CPU load
by not printing every line.
2014-07-13 03:58:16 +09:00
Junegunn Choi
35c5f2830b Revert "Real-time progress report"
This reverts commit 60b907c87f.
2014-07-13 03:22:25 +09:00
Junegunn Choi
60b907c87f Real-time progress report 2014-07-13 03:05:54 +09:00
Junegunn Choi
9ceb9caa09 Minor refactoring 2014-07-10 00:44:09 +09:00
Junegunn Choi
42a42e7e71 Fix after directory and Plugfile on Windows 2014-07-10 00:13:32 +09:00
Junegunn Choi
8885b1086f Minor refactoring in ODL: no need to pass full dict 2014-07-09 01:14:03 +09:00
Junegunn Choi
90c07f269c Fix <Plug>-based ODL on visual range spanning multiple lines 2014-07-07 22:55:44 +09:00
Junegunn Choi
f1c5157e35 Fix <Plug>-based on-demand-loading on visual mode 2014-07-07 19:06:20 +09:00
Junegunn Choi
7f1ec7b12b Load ftplugins while avoiding extraneous FileType events (#24, #25) 2014-07-04 14:20:48 +09:00
Junegunn Choi
f90afc9081 Remove images from repo 2014-06-23 23:39:48 +09:00
Junegunn Choi
612b9b3afd Fix test cases for travis-ci 2014-06-23 13:16:14 +09:00
Junegunn Choi
58891e05be Travis-CI integration 2014-06-23 12:57:46 +09:00
Junegunn Choi
baf7b18f73 Update test runner script 2014-06-23 12:53:51 +09:00
Junegunn Choi
cc37ed48be Improve PlugStatus message
Invalid branch/tag: %s (expected: %s). Try PlugUpdate.
2014-06-23 12:22:25 +09:00
Junegunn Choi
afe7dc6f8f Use case-sensitive match 2014-06-23 04:04:03 +09:00
Junegunn Choi
8863a3a53c Fix #28: False alarm from PlugStatus when tag used 2014-06-23 04:02:49 +09:00
Junegunn Choi
ee04a646d3 Fix: dependent plugins not loaded after initial installaion 2014-06-22 21:49:51 +09:00
Junegunn Choi
6ddee62977 Ensure ftplugin files are loaded (#24) 2014-06-22 13:09:18 +09:00
Junegunn Choi
8cf5fca9ca Revert "Ensure ftplugin files are loaded (#24)"
This reverts commit a026eb39c4.

Conflicts:
	plug.vim
2014-06-22 12:49:22 +09:00
Junegunn Choi
347fccb030 Revert "Remove FileType autocmd after loaded"
This reverts commit db3f5ad5c3.

Conflicts:
	plug.vim
2014-06-22 12:45:21 +09:00
Junegunn Choi
a026eb39c4 Ensure ftplugin files are loaded (#24)
If `filetype plugin on` is called before `plug#end()`, filetype
plugin handler is invoked before ODL autocmd from vim-plug which
updates runtimepath and ftplugin files are not loaded.
2014-06-22 10:27:15 +09:00
Junegunn Choi
4d352e1849 Revert "Clear #filetypeplugin for filetype-based ODL (#24)"
This reverts commit 1d477a1a01.
2014-06-22 10:21:58 +09:00
Junegunn Choi
db3f5ad5c3 Remove FileType autocmd after loaded 2014-06-22 09:58:14 +09:00
Junegunn Choi
1d477a1a01 Clear #filetypeplugin for filetype-based ODL (#24) 2014-06-22 04:24:19 +09:00
Junegunn Choi
288a4f72ce Add pending test case on dependency resolution 2014-06-20 21:35:42 +09:00
Junegunn Choi
5168cd50db Allow updating subset of plugins
This commit extends `PlugInstall` and `PlugUpdate` command to allow
updating only a subset of plugins as follows:

    " With tab completion of plugin names
    :PlugInstall vim-easy-align seoul256
    :PlugUpdate vim-easy-align seoul256
2014-06-20 20:53:57 +09:00
Junegunn Choi
4d32762432 Allow -range in on-demand loading commands 2014-06-20 20:35:33 +09:00
Junegunn Choi
8dff1dae37 Allow trailing comment after Plug declaration (#23) 2014-06-20 09:58:50 +09:00
Junegunn Choi
b5b687ad9a On-demand loading on filetypes (#21) 2014-06-17 11:59:42 +09:00
Junegunn Choi
7e69a50890 Fix on-demand loading: load ftdetect and **/*.vim as well 2014-06-17 11:45:42 +09:00
Junegunn Choi
476a613746 Fix #19: install error 2014-06-06 00:16:57 +09:00
Junegunn Choi
12b5dcb903 git submodule update --init --recursive (#18) 2014-06-03 18:51:01 +09:00
14 changed files with 396 additions and 145 deletions

12
.travis.yml Normal file
View File

@@ -0,0 +1,12 @@
language: vim
before_script: |
hg clone https://code.google.com/p/vim/
cd vim
./configure --with-features=huge --enable-rubyinterp
make
sudo make install
cd -
script: |
test/run !

View File

@@ -1,11 +1,12 @@
![vim-plug](https://raw.github.com/junegunn/vim-plug/master/plug.png) ![vim-plug](https://raw.github.com/junegunn/vim-plug/master/plug.png)
![travis-ci](https://travis-ci.org/junegunn/vim-plug.svg?branch=master)
A single-file Vim plugin manager. A single-file Vim plugin manager.
Somewhere between [Pathogen](https://github.com/tpope/vim-pathogen) and Somewhere between [Pathogen](https://github.com/tpope/vim-pathogen) and
[Vundle](https://github.com/gmarik/vundle), but with faster parallel installer. [Vundle](https://github.com/gmarik/vundle), but with faster parallel installer.
![](https://raw.github.com/junegunn/vim-plug/master/gif/vim-plug.gif) ![](https://raw.github.com/junegunn/i/master/vim-plug/installer.gif)
### Pros. ### Pros.
@@ -38,7 +39,8 @@ call plug#begin('~/.vim/plugged')
Plug 'junegunn/seoul256.vim' Plug 'junegunn/seoul256.vim'
Plug 'junegunn/vim-easy-align' Plug 'junegunn/vim-easy-align'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Plug 'user/repo1', 'branch_or_tag' " Plug 'user/repo1', 'branch_or_tag'
" Plug 'user/repo2', { 'rtp': 'vim/plugin/dir', 'branch': 'devel' } " Plug 'user/repo2', { 'rtp': 'vim/plugin/dir', 'branch': 'devel' }
" Plug 'git@github.com:junegunn/vim-github-dashboard.git' " Plug 'git@github.com:junegunn/vim-github-dashboard.git'
@@ -59,14 +61,14 @@ before the call.
### Commands ### Commands
| Command | Description | | Command | Description |
| ---------------------- | ------------------------------------------------------------------ | | --------------------------------- | ------------------------------------------------------------------ |
| PlugInstall [#threads] | Install plugins | | PlugInstall [name ...] [#threads] | Install plugins |
| PlugUpdate [#threads] | Install or update plugins | | PlugUpdate [name ...] [#threads] | Install or update plugins |
| PlugClean[!] | Remove unused directories (bang version will clean without prompt) | | PlugClean[!] | Remove unused directories (bang version will clean without prompt) |
| PlugUpgrade | Upgrade vim-plug itself | | PlugUpgrade | Upgrade vim-plug itself |
| PlugStatus | Check the status of plugins | | PlugStatus | Check the status of plugins |
| PlugDiff | See the updated changes from the previous PlugUpdate | | PlugDiff | See the updated changes from the previous PlugUpdate |
### Options for parallel installer ### Options for parallel installer
@@ -97,6 +99,12 @@ Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
" Multiple commands " Multiple commands
Plug 'junegunn/vim-github-dashboard', { 'on': ['GHDashboard', 'GHActivity'] } Plug 'junegunn/vim-github-dashboard', { 'on': ['GHDashboard', 'GHActivity'] }
" Loaded when clojure file is opened
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" On-demand loading on both conditions
Plug 'junegunn/vader.vim', { 'on': 'Vader', 'for': 'vader' }
``` ```
### Dependency resolution ### Dependency resolution

Binary file not shown.

Before

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 306 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 922 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 650 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 521 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

319
plug.vim
View File

@@ -24,7 +24,7 @@
" You can change the location of the plugins with plug#begin(path) call. " You can change the location of the plugins with plug#begin(path) call.
" "
" "
" Copyright (c) 2013 Junegunn Choi " Copyright (c) 2014 Junegunn Choi
" "
" MIT License " MIT License
" "
@@ -91,9 +91,9 @@ function! plug#begin(...)
" we want to keep track of the order plugins where registered. " we want to keep track of the order plugins where registered.
let g:plugs_order = [] let g:plugs_order = []
command! -nargs=+ Plug call s:add(1, <args>) command! -nargs=+ -bar Plug call s:add(1, <args>)
command! -nargs=* PlugInstall call s:install(<f-args>) command! -nargs=* -complete=customlist,s:names PlugInstall call s:install(<f-args>)
command! -nargs=* PlugUpdate call s:update(<f-args>) command! -nargs=* -complete=customlist,s:names PlugUpdate call s:update(<f-args>)
command! -nargs=0 -bang PlugClean call s:clean('<bang>' == '!') command! -nargs=0 -bang PlugClean call s:clean('<bang>' == '!')
command! -nargs=0 PlugUpgrade if s:upgrade() | execute "source ". s:me | endif command! -nargs=0 PlugUpgrade if s:upgrade() | execute "source ". s:me | endif
command! -nargs=0 PlugStatus call s:status() command! -nargs=0 PlugStatus call s:status()
@@ -102,6 +102,10 @@ function! plug#begin(...)
return 1 return 1
endfunction endfunction
function! s:to_a(v)
return type(a:v) == 3 ? a:v : [a:v]
endfunction
function! plug#end() function! plug#end()
if !exists('g:plugs') if !exists('g:plugs')
echoerr 'Call plug#begin() first' echoerr 'Call plug#begin() first'
@@ -112,6 +116,14 @@ function! plug#end()
let keys = keys(s:extend(keys)) let keys = keys(s:extend(keys))
endwhile endwhile
if exists('#PlugLOD')
augroup PlugLOD
autocmd!
augroup END
augroup! PlugLOD
endif
let lod = {}
filetype off filetype off
" we want to make sure the plugin directories are added to rtp in the same " we want to make sure the plugin directories are added to rtp in the same
" order that they are registered with the Plug command. since the s:add_rtp " order that they are registered with the Plug command. since the s:add_rtp
@@ -119,38 +131,80 @@ function! plug#end()
" need to loop through the plugins in reverse " need to loop through the plugins in reverse
for name in reverse(copy(g:plugs_order)) for name in reverse(copy(g:plugs_order))
let plug = g:plugs[name] let plug = g:plugs[name]
if !has_key(plug, 'on') && !has_key(plug, 'for')
call s:add_rtp(s:rtp(plug))
continue
endif
if has_key(plug, 'on') if has_key(plug, 'on')
let commands = type(plug.on) == 1 ? [plug.on] : plug.on let commands = s:to_a(plug.on)
for cmd in commands for cmd in commands
if cmd =~ '^<Plug>.\+' if cmd =~ '^<Plug>.\+'
if empty(mapcheck(cmd)) && empty(mapcheck(cmd, 'i')) if empty(mapcheck(cmd)) && empty(mapcheck(cmd, 'i'))
for [mode, prefix] in [['i', "<C-O>"], ['', '']] for [mode, map_prefix, key_prefix] in
\ [['i', "<C-O>", ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
execute printf( execute printf(
\ "%snoremap <silent> %s %s:call <SID>lod_map(%s, %s)<CR>", \ "%snoremap <silent> %s %s:<C-U>call <SID>lod_map(%s, %s, '%s')<CR>",
\ mode, cmd, prefix, string(cmd), string(plug)) \ mode, cmd, map_prefix, string(cmd), string(name), key_prefix)
endfor endfor
endif endif
elseif !exists(':'.cmd) elseif !exists(':'.cmd)
execute printf( execute printf(
\ "command! -nargs=* -bang %s call s:lod_cmd(%s, '<bang>', <q-args>, %s)", \ "command! -nargs=* -range -bang %s call s:lod_cmd(%s, '<bang>', <line1>, <line2>, <q-args>, %s)",
\ cmd, string(cmd), string(plug)) \ cmd, string(cmd), string(name))
endif endif
endfor endfor
else
call s:add_rtp(s:rtp(plug))
endif endif
if has_key(plug, 'for')
for vim in split(globpath(s:rtp(plug), 'ftdetect/**/*.vim'), '\n')
execute 'source '.vim
endfor
for key in s:to_a(plug.for)
if !has_key(lod, key)
let lod[key] = []
endif
call add(lod[key], name)
endfor
endif
endfor
for [key, names] in items(lod)
augroup PlugLOD
execute printf('autocmd FileType %s call <SID>lod_ft(%s, %s)',
\ key, string(key), string(reverse(names)))
augroup END
endfor endfor
filetype plugin indent on filetype plugin indent on
syntax on syntax on
endfunction endfunction
function! s:rtp(spec) if s:is_win
let rtp = s:dirpath(a:spec.dir . get(a:spec, 'rtp', '')) function! s:rtp(spec)
if s:is_win let rtp = s:dirpath(a:spec.dir . get(a:spec, 'rtp', ''))
let rtp = substitute(rtp, '\\*$', '', '') return substitute(rtp, '\\*$', '', '')
endif endfunction
return rtp
endfunction function! s:path(path)
return substitute(substitute(a:path, '/', '\', 'g'), '[/\\]*$', '', '')
endfunction
function! s:dirpath(path)
return s:path(a:path) . '\'
endfunction
else
function! s:rtp(spec)
return s:dirpath(a:spec.dir . get(a:spec, 'rtp', ''))
endfunction
function! s:path(path)
return substitute(a:path, '[/\\]*$', '', '')
endfunction
function! s:dirpath(path)
return s:path(a:path) . '/'
endfunction
endif
function! s:esc(path) function! s:esc(path)
return substitute(a:path, ' ', '\\ ', 'g') return substitute(a:path, ' ', '\\ ', 'g')
@@ -158,31 +212,40 @@ endfunction
function! s:add_rtp(rtp) function! s:add_rtp(rtp)
execute "set rtp^=".s:esc(a:rtp) execute "set rtp^=".s:esc(a:rtp)
if isdirectory(a:rtp.'after') let after = globpath(a:rtp, 'after')
execute "set rtp+=".s:esc(a:rtp.'after') if isdirectory(after)
execute "set rtp+=".s:esc(after)
endif endif
endfunction endfunction
function! s:lod(plug) function! s:lod(plug, types)
let rtp = s:rtp(a:plug) let rtp = s:rtp(a:plug)
call s:add_rtp(rtp) call s:add_rtp(rtp)
for dir in ['plugin', 'after'] for dir in a:types
for vim in split(globpath(rtp, dir.'/*.vim'), '\n') for vim in split(globpath(rtp, dir.'/**/*.vim'), '\n')
execute 'source '.vim execute 'source '.vim
endfor endfor
endfor endfor
endfunction endfunction
function! s:lod_cmd(cmd, bang, args, plug) function! s:lod_ft(pat, names)
execute 'delc '.a:cmd for name in a:names
call s:lod(a:plug) call s:lod(g:plugs[name], ['plugin', 'after'])
execute printf("%s%s %s", a:cmd, a:bang, a:args) endfor
execute 'autocmd! PlugLOD FileType ' . a:pat
silent! doautocmd filetypeplugin FileType
endfunction endfunction
function! s:lod_map(map, plug) function! s:lod_cmd(cmd, bang, l1, l2, args, name)
execute 'delc '.a:cmd
call s:lod(g:plugs[a:name], ['plugin', 'ftdetect', 'after'])
execute printf("%s%s%s %s", (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
endfunction
function! s:lod_map(map, name, prefix)
execute 'unmap '.a:map execute 'unmap '.a:map
execute 'iunmap '.a:map execute 'iunmap '.a:map
call s:lod(a:plug) call s:lod(g:plugs[a:name], ['plugin', 'ftdetect', 'after'])
let extra = '' let extra = ''
while 1 while 1
let c = getchar(0) let c = getchar(0)
@@ -191,7 +254,7 @@ function! s:lod_map(map, plug)
endif endif
let extra .= nr2char(c) let extra .= nr2char(c)
endwhile endwhile
call feedkeys(substitute(a:map, '^<Plug>', "\<Plug>", '') . extra) call feedkeys(a:prefix . substitute(a:map, '^<Plug>', "\<Plug>", '') . extra)
endfunction endfunction
function! s:add(...) function! s:add(...)
@@ -214,6 +277,9 @@ function! s:add(...)
return return
endif endif
let name = substitute(split(plugin, '/')[-1], '\.git$', '', '')
if !force && has_key(g:plugs, name) | return | endif
if plugin =~ ':' if plugin =~ ':'
let uri = plugin let uri = plugin
else else
@@ -223,9 +289,6 @@ function! s:add(...)
let uri = 'https://git:@github.com/' . plugin . '.git' let uri = 'https://git:@github.com/' . plugin . '.git'
endif endif
let name = substitute(split(plugin, '/')[-1], '\.git$', '', '')
if !force && has_key(g:plugs, name) | return | endif
let dir = s:dirpath( fnamemodify(join([g:plug_home, name], '/'), ':p') ) let dir = s:dirpath( fnamemodify(join([g:plug_home, name], '/'), ':p') )
let spec = extend(opts, { 'dir': dir, 'uri': uri }) let spec = extend(opts, { 'dir': dir, 'uri': uri })
let g:plugs[name] = spec let g:plugs[name] = spec
@@ -260,7 +323,11 @@ function! s:syntax()
syn match plugBracket /[[\]]/ contained syn match plugBracket /[[\]]/ contained
syn match plugX /x/ contained syn match plugX /x/ contained
syn match plugDash /^-/ syn match plugDash /^-/
syn match plugPlus /^+/
syn match plugStar /^*/
syn match plugName /\(^- \)\@<=[^:]*/ syn match plugName /\(^- \)\@<=[^:]*/
syn match plugInstall /\(^+ \)\@<=[^:]*/
syn match plugUpdate /\(^* \)\@<=[^:]*/
syn match plugCommit /^ [0-9a-z]\{7} .*/ contains=plugRelDate,plugSha syn match plugCommit /^ [0-9a-z]\{7} .*/ contains=plugRelDate,plugSha
syn match plugSha /\(^ \)\@<=[0-9a-z]\{7}/ contained syn match plugSha /\(^ \)\@<=[0-9a-z]\{7}/ contained
syn match plugRelDate /([^)]*)$/ contained syn match plugRelDate /([^)]*)$/ contained
@@ -271,8 +338,15 @@ function! s:syntax()
hi def link plugX Exception hi def link plugX Exception
hi def link plugBracket Structure hi def link plugBracket Structure
hi def link plugNumber Number hi def link plugNumber Number
hi def link plugDash Special hi def link plugDash Special
hi def link plugPlus Constant
hi def link plugStar Boolean
hi def link plugName Label hi def link plugName Label
hi def link plugInstall Function
hi def link plugUpdate Type
hi def link plugError Error hi def link plugError Error
hi def link plugRelDate Comment hi def link plugRelDate Comment
hi def link plugSha Identifier hi def link plugSha Identifier
@@ -339,19 +413,53 @@ function! s:finish(pull)
endif endif
endfunction endfunction
function! s:update_impl(pull, args) function! s:names(...)
let threads = len(a:args) > 0 ? a:args[0] : get(g:, 'plug_threads', 16) return filter(keys(g:plugs), 'stridx(v:val, a:1) == 0')
endfunction
function! s:update_impl(pull, args) abort
let args = copy(a:args)
let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ?
\ remove(args, -1) : get(g:, 'plug_threads', 16)
let todo = empty(args) ? g:plugs :
\ filter(copy(g:plugs), 'index(args, v:key) >= 0')
if empty(todo)
echohl WarningMsg
echo 'No plugin to '. (a:pull ? 'update' : 'install') . '.'
echohl None
return
endif
call s:prepare() call s:prepare()
call append(0, a:pull ? 'Updating plugins' : 'Installing plugins') call append(0, a:pull ? 'Updating plugins' : 'Installing plugins')
call append(1, '['. s:lpad('', len(g:plugs)) .']') call append(1, '['. s:lpad('', len(todo)) .']')
normal! 2G normal! 2G
redraw redraw
let len = len(g:plugs)
if has('ruby') && threads > 1 if has('ruby') && threads > 1
call s:update_parallel(a:pull, threads) try
call s:update_parallel(a:pull, todo, threads)
catch
let lines = getline(4, '$')
let printed = {}
silent 4,$d
for line in lines
let name = get(matchlist(line, '^. \([^:]\+\):'), 1, '')
if empty(name) || !has_key(printed, name)
let printed[name] = 1
call append('$', line)
endif
endfor
echoerr v:exception
endtry
else else
call s:update_serial(a:pull) call s:update_serial(a:pull, todo)
endif
if len(g:plugs) > len
call plug#end()
endif endif
call s:finish(a:pull) call s:finish(a:pull)
endfunction endfunction
@@ -361,7 +469,7 @@ function! s:extend(names)
try try
command! -nargs=+ Plug call s:add(0, <args>) command! -nargs=+ Plug call s:add(0, <args>)
for name in a:names for name in a:names
let plugfile = s:rtp(g:plugs[name]) . s:plug_file let plugfile = globpath(s:rtp(g:plugs[name]), s:plug_file)
if filereadable(plugfile) if filereadable(plugfile)
execute "source ". s:esc(plugfile) execute "source ". s:esc(plugfile)
endif endif
@@ -380,10 +488,10 @@ function! s:update_progress(pull, cnt, bar, total)
redraw redraw
endfunction endfunction
function! s:update_serial(pull) function! s:update_serial(pull, todo)
let st = reltime() let st = reltime()
let base = g:plug_home let base = g:plug_home
let todo = copy(g:plugs) let todo = copy(a:todo)
let total = len(todo) let total = len(todo)
let done = {} let done = {}
let bar = '' let bar = ''
@@ -397,7 +505,7 @@ function! s:update_serial(pull)
if valid if valid
let result = a:pull ? let result = a:pull ?
\ s:system( \ s:system(
\ printf('git checkout -q %s 2>&1 && git pull origin %s 2>&1', \ printf('git checkout -q %s 2>&1 && git pull origin %s 2>&1 && git submodule update --init --recursive 2>&1',
\ s:shellesc(spec.branch), s:shellesc(spec.branch))) : 'Already installed' \ s:shellesc(spec.branch), s:shellesc(spec.branch))) : 'Already installed'
let error = a:pull ? v:shell_error != 0 : 0 let error = a:pull ? v:shell_error != 0 : 0
else else
@@ -408,12 +516,12 @@ function! s:update_serial(pull)
if !isdirectory(base) if !isdirectory(base)
call mkdir(base, 'p') call mkdir(base, 'p')
endif endif
execute 'cd '.base
let result = s:system( let result = s:system(
\ printf('git clone --recursive %s -b %s %s 2>&1', \ printf('git clone --recursive %s -b %s %s 2>&1 && cd %s && git submodule update --init --recursive 2>&1',
\ s:shellesc(spec.uri), \ s:shellesc(spec.uri),
\ s:shellesc(spec.branch), \ s:shellesc(spec.branch),
\ s:shellesc(substitute(spec.dir, '[\/]\+$', '', '')))) \ s:shellesc(substitute(spec.dir, '[\/]\+$', '', '')),
\ s:shellesc(spec.dir)))
let error = v:shell_error != 0 let error = v:shell_error != 0
endif endif
cd - cd -
@@ -434,8 +542,25 @@ function! s:update_serial(pull)
call setline(1, "Updated. Elapsed time: " . split(reltimestr(reltime(st)))[0] . ' sec.') call setline(1, "Updated. Elapsed time: " . split(reltimestr(reltime(st)))[0] . ' sec.')
endfunction endfunction
function! s:update_parallel(pull, threads) function! s:update_parallel(pull, todo, threads)
ruby << EOF ruby << EOF
module PlugStream
SEP = ["\r", "\n", nil]
def get_line
buffer = ''
loop do
char = readchar rescue return
if SEP.include? char.chr
buffer << $/
break
else
buffer << char
end
end
buffer
end
end unless defined?(PlugStream)
def esc arg def esc arg
%["#{arg.gsub('"', '\"')}"] %["#{arg.gsub('"', '\"')}"]
end end
@@ -448,58 +573,73 @@ function! s:update_parallel(pull, threads)
iswin = VIM::evaluate('s:is_win').to_i == 1 iswin = VIM::evaluate('s:is_win').to_i == 1
pull = VIM::evaluate('a:pull').to_i == 1 pull = VIM::evaluate('a:pull').to_i == 1
base = VIM::evaluate('g:plug_home') base = VIM::evaluate('g:plug_home')
all = VIM::evaluate('copy(g:plugs)') all = VIM::evaluate('copy(a:todo)')
limit = VIM::evaluate('get(g:, "plug_timeout", 60)') limit = VIM::evaluate('get(g:, "plug_timeout", 60)')
nthr = VIM::evaluate('a:threads').to_i nthr = VIM::evaluate('a:threads').to_i
maxy = VIM::evaluate('winheight(".")').to_i
cd = iswin ? 'cd /d' : 'cd' cd = iswin ? 'cd /d' : 'cd'
done = {}
tot = 0 tot = 0
bar = '' bar = ''
skip = 'Already installed' skip = 'Already installed'
mtx = Mutex.new mtx = Mutex.new
take1 = proc { mtx.synchronize { running && all.shift } } take1 = proc { mtx.synchronize { running && all.shift } }
logh = proc { logh = proc {
cnt = done.length cnt = $curbuf[2][1...-1].strip.length
tot = VIM::evaluate('len(g:plugs)') || tot tot = VIM::evaluate('len(a:todo)') || tot
$curbuf[1] = "#{pull ? 'Updating' : 'Installing'} plugins (#{cnt}/#{tot})" $curbuf[1] = "#{pull ? 'Updating' : 'Installing'} plugins (#{cnt}/#{tot})"
$curbuf[2] = '[' + bar.ljust(tot) + ']' $curbuf[2] = '[' + bar.ljust(tot) + ']'
VIM::command('normal! 2G') VIM::command('normal! 2G')
VIM::command('redraw') unless iswin VIM::command('redraw') unless iswin
} }
log = proc { |name, result, ok| where = proc { |name| (1..($curbuf.length)).find { |l| $curbuf[l] =~ /^[-+x*] #{name}:/ } }
log = proc { |name, result, type|
mtx.synchronize do mtx.synchronize do
bar += ok ? '=' : 'x' ing = ![true, false].include?(type)
done[name] = true bar += type ? '=' : 'x' unless ing
b = case type
when :install then '+' when :update then '*'
when true, nil then '-' else 'x' end
result = result =
if ok if type || type.nil?
["- #{name}: #{result.lines.to_a.last.strip}"] ["#{b} #{name}: #{result.lines.to_a.last}"]
elsif result =~ /^Interrupted|^Timeout/ elsif result =~ /^Interrupted|^Timeout/
["x #{name}: #{result}"] ["#{b} #{name}: #{result}"]
else else
["x #{name}"] + result.lines.map { |l| " " << l } ["#{b} #{name}"] + result.lines.map { |l| " " << l }
end end
if lnum = where.call(name)
$curbuf.delete lnum
lnum = 4 if ing && lnum > maxy
end
result.each_with_index do |line, offset| result.each_with_index do |line, offset|
$curbuf.append 3 + offset, line.chomp $curbuf.append((lnum || 4) - 1 + offset, line.gsub(/\e\[./, '').chomp)
end end
logh.call logh.call
end end
} }
bt = proc { |cmd| bt = proc { |cmd, name, type|
begin begin
fd = nil fd = nil
Timeout::timeout(limit) do data = ''
if iswin if iswin
Timeout::timeout(limit) do
tmp = VIM::evaluate('tempname()') tmp = VIM::evaluate('tempname()')
system("#{cmd} > #{tmp}") system("#{cmd} > #{tmp}")
data = File.read(tmp).chomp data = File.read(tmp).chomp
File.unlink tmp rescue nil File.unlink tmp rescue nil
else
fd = IO.popen(cmd)
data = fd.read.chomp
fd.close
end end
[$? == 0, data] else
fd = IO.popen(cmd).extend(PlugStream)
first_line = true
log_prob = 1.0 / nthr
while line = Timeout::timeout(limit) { fd.get_line }
data << line
log.call name, line.chomp, type if name && (first_line || rand < log_prob)
first_line = false
end
fd.close
end end
[$? == 0, data.chomp]
rescue Timeout::Error, Interrupt => e rescue Timeout::Error, Interrupt => e
if fd && !fd.closed? if fd && !fd.closed?
pids = [fd.pid] pids = [fd.pid]
@@ -507,7 +647,7 @@ function! s:update_parallel(pull, threads)
children = pids children = pids
until children.empty? until children.empty?
children = children.map { |pid| children = children.map { |pid|
`pgrep -P #{pid}`.lines.map(&:chomp) `pgrep -P #{pid}`.lines.map { |l| l.chomp }
}.flatten }.flatten
pids += children pids += children
end end
@@ -532,6 +672,7 @@ function! s:update_parallel(pull, threads)
main.kill main.kill
} }
progress = iswin ? '' : '--progress'
until all.empty? until all.empty?
names = all.keys names = all.keys
[names.length, nthr].min.times do [names.length, nthr].min.times do
@@ -541,10 +682,11 @@ function! s:update_parallel(pull, threads)
name = pair.first name = pair.first
dir, uri, branch = pair.last.values_at *%w[dir uri branch] dir, uri, branch = pair.last.values_at *%w[dir uri branch]
branch = esc branch branch = esc branch
subm = "git submodule update --init --recursive 2>&1"
ok, result = ok, result =
if File.directory? dir if File.directory? dir
dir = esc dir dir = esc dir
ret, data = bt.call "#{cd} #{dir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url" ret, data = bt.call "#{cd} #{dir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url", nil, nil
current_uri = data.lines.to_a.last current_uri = data.lines.to_a.last
if !ret if !ret
if data =~ /^Interrupted|^Timeout/ if data =~ /^Interrupted|^Timeout/
@@ -558,7 +700,8 @@ function! s:update_parallel(pull, threads)
"PlugClean required."].join($/)] "PlugClean required."].join($/)]
else else
if pull if pull
bt.call "#{cd} #{dir} && git checkout -q #{branch} 2>&1 && git pull origin #{branch} 2>&1" log.call name, 'Updating ...', :update
bt.call "#{cd} #{dir} && git checkout -q #{branch} 2>&1 && (git pull origin #{branch} #{progress} 2>&1 && #{subm})", name, :update
else else
[true, skip] [true, skip]
end end
@@ -566,14 +709,15 @@ function! s:update_parallel(pull, threads)
else else
FileUtils.mkdir_p(base) FileUtils.mkdir_p(base)
d = esc dir.sub(%r{[\\/]+$}, '') d = esc dir.sub(%r{[\\/]+$}, '')
bt.call "#{cd} #{base} && git clone --recursive #{uri} -b #{branch} #{d} 2>&1" log.call name, 'Installing ...', :install
bt.call "(git clone #{progress} --recursive #{uri} -b #{branch} #{d} 2>&1 && cd #{esc dir} && #{subm})", name, :install
end end
log.call name, result, ok log.call name, result, ok
end end
} if running } if running
end end
end end
threads.each(&:join) threads.each { |t| t.join rescue nil }
mtx.synchronize { threads.clear } mtx.synchronize { threads.clear }
all.merge!(VIM::evaluate("s:extend(#{names.inspect})") || {}) all.merge!(VIM::evaluate("s:extend(#{names.inspect})") || {})
logh.call logh.call
@@ -583,20 +727,6 @@ function! s:update_parallel(pull, threads)
EOF EOF
endfunction endfunction
function! s:path(path)
return substitute(s:is_win ? substitute(a:path, '/', '\', 'g') : a:path,
\ '[/\\]*$', '', '')
endfunction
function! s:dirpath(path)
let path = s:path(a:path)
if s:is_win
return path !~ '\\$' ? path.'\' : path
else
return path !~ '/$' ? path.'/' : path
endif
endfunction
function! s:shellesc(arg) function! s:shellesc(arg)
return '"'.substitute(a:arg, '"', '\\"', 'g').'"' return '"'.substitute(a:arg, '"', '\\"', 'g').'"'
endfunction endfunction
@@ -628,6 +758,11 @@ function! s:system(cmd)
return system(s:is_win ? '('.a:cmd.')' : a:cmd) return system(s:is_win ? '('.a:cmd.')' : a:cmd)
endfunction endfunction
function! s:system_chomp(str)
let ret = s:system(a:str)
return v:shell_error ? '' : substitute(ret, '\n$', '', '')
endfunction
function! s:git_valid(spec, check_branch, cd) function! s:git_valid(spec, check_branch, cd)
let ret = 1 let ret = 1
let msg = 'OK' let msg = 'OK'
@@ -635,7 +770,7 @@ function! s:git_valid(spec, check_branch, cd)
if a:cd | execute "cd " . s:esc(a:spec.dir) | endif if a:cd | execute "cd " . s:esc(a:spec.dir) | endif
let result = split(s:system("git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url"), '\n') let result = split(s:system("git rev-parse --abbrev-ref HEAD 2>&1 && git config remote.origin.url"), '\n')
let remote = result[-1] let remote = result[-1]
if v:shell_error != 0 if v:shell_error
let msg = join([remote, "PlugClean required."], "\n") let msg = join([remote, "PlugClean required."], "\n")
let ret = 0 let ret = 0
elseif !s:compare_git_uri(remote, a:spec.uri) elseif !s:compare_git_uri(remote, a:spec.uri)
@@ -645,9 +780,13 @@ function! s:git_valid(spec, check_branch, cd)
let ret = 0 let ret = 0
elseif a:check_branch elseif a:check_branch
let branch = result[0] let branch = result[0]
if a:spec.branch != branch if a:spec.branch !=# branch
let msg = 'Invalid branch: '.branch.'. Try PlugUpdate.' let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1')
let ret = 0 if a:spec.branch !=# tag
let msg = printf('Invalid branch/tag: %s (expected: %s). Try PlugUpdate.',
\ (empty(tag) ? branch : tag), a:spec.branch)
let ret = 0
endif
endif endif
endif endif
if a:cd | cd - | endif if a:cd | cd - | endif

View File

@@ -7,8 +7,10 @@ Test cases for vim-plug
### Run ### Run
```vim ```
:e workflow.vader | Vader ./run
./run !
``` ```
### TODO ### TODO
@@ -18,7 +20,6 @@ Test cases for the following features are currently missing:
- Output formatting - Output formatting
- Timeout or interrupt cleaning up git processes - Timeout or interrupt cleaning up git processes
- User prompt in PlugClean command - User prompt in PlugClean command
- Automatic dependency resolution using Plugfile
- Single-threaded installer - Single-threaded installer
- Windows support - Windows support

View File

@@ -5,15 +5,18 @@ cd ..
PLUG_SRC=$(pwd)/plug.vim PLUG_SRC=$(pwd)/plug.vim
cd - > /dev/null cd - > /dev/null
export VADER_RTP=$TMPDIR/vader-rtp if [ ! -d vader.vim ]; then
vim -e +Vader -c ':call writefile([fnamemodify(globpath(&rtp, "autoload/vader.vim"), ":h:h")], $VADER_RTP)' +q git clone https://github.com/junegunn/vader.vim.git
fi
MINI_VIMRC=$TMPDIR/mini-vimrc cat > /tmp/mini-vimrc << VIMRC
cat > $MINI_VIMRC << EOF set rtp+=vader.vim
let \$MYVIMRC = '$MINI_VIMRC'
set nocompatible
set rtp=$(cat $VADER_RTP)
source $PLUG_SRC source $PLUG_SRC
EOF VIMRC
if [ "$1" = '!' ]; then
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader! workflow.vader' > /dev/null
else
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader workflow.vader'
fi
vim -u $MINI_VIMRC +Vader*

View File

@@ -1,5 +1,5 @@
Execute (Initialize test environment): Execute (Initialize test environment):
Save &rtp, g:plug_home, $MYVIMRC Save &rtp, g:plugs, g:plug_home, $MYVIMRC
let vader = fnamemodify(globpath(&rtp, 'autoload/vader.vim'), ':h:h') let vader = fnamemodify(globpath(&rtp, 'autoload/vader.vim'), ':h:h')
let plug = fnamemodify(globpath(&rtp, 'autoload/plug.vim'), ':h:h') let plug = fnamemodify(globpath(&rtp, 'autoload/plug.vim'), ':h:h')
@@ -15,6 +15,15 @@ Execute (Initialize test environment):
colo default colo default
pclose pclose
function! PlugStatusSorted()
PlugStatus
%y
q
normal! P
%sort
g/^$/d
endfunction
let g:vimrc_reloaded = 0 let g:vimrc_reloaded = 0
let vimrc = tempname() let vimrc = tempname()
call writefile(['let g:vimrc_reloaded += 1'], vimrc) call writefile(['let g:vimrc_reloaded += 1'], vimrc)
@@ -64,9 +73,15 @@ Execute (Test Plug command):
AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
AssertEqual 'no-t_co', g:plugs['seoul256.vim'].branch AssertEqual 'no-t_co', g:plugs['seoul256.vim'].branch
" Git repo with tag
Plug 'junegunn/goyo.vim', '1.5.3'
AssertEqual 'https://git:@github.com/junegunn/goyo.vim.git', g:plugs['goyo.vim'].uri
AssertEqual join([temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir
AssertEqual '1.5.3', g:plugs['goyo.vim'].branch
" Git URI " Git URI
Plug 'git@github.com:junegunn/vim-emoji.git' Plug 'https://bitbucket.org/junegunn/vim-emoji.git'
AssertEqual 'git@github.com:junegunn/vim-emoji.git', g:plugs['vim-emoji'].uri AssertEqual 'https://bitbucket.org/junegunn/vim-emoji.git', g:plugs['vim-emoji'].uri
AssertEqual 'master', g:plugs['vim-emoji'].branch AssertEqual 'master', g:plugs['vim-emoji'].branch
AssertEqual join([temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir AssertEqual join([temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir
@@ -75,18 +90,20 @@ Execute (Test Plug command):
AssertEqual 'https://git:@github.com/vim-scripts/beauty256.git', g:plugs.beauty256.uri AssertEqual 'https://git:@github.com/vim-scripts/beauty256.git', g:plugs.beauty256.uri
AssertEqual 'master', g:plugs.beauty256.branch AssertEqual 'master', g:plugs.beauty256.branch
AssertEqual 3, len(g:plugs) AssertEqual 4, len(g:plugs)
Execute (Plug command with dictionary option): Execute (Plug command with dictionary option):
Log string(g:plugs)
Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co', 'rtp': '././' } Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co', 'rtp': '././' }
AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
AssertEqual '././', g:plugs['seoul256.vim'].rtp AssertEqual '././', g:plugs['seoul256.vim'].rtp
AssertEqual 3, len(g:plugs) Log string(g:plugs)
AssertEqual 4, len(g:plugs)
Execute (PlugStatus before installation): Execute (PlugStatus before installation):
PlugStatus PlugStatus
AssertEqual 3, len(filter(getline(1, line('$')), 'v:val =~ "Not found"')) AssertEqual 4, len(filter(getline(1, line('$')), 'v:val =~ "Not found"'))
q q
Execute (PlugClean before installation): Execute (PlugClean before installation):
@@ -116,25 +133,44 @@ Execute (PlugClean after installation):
Execute (PlugStatus after installation): Execute (PlugStatus after installation):
PlugStatus PlugStatus
AssertEqual 3, len(filter(getline(1, line('$')), 'v:val =~ "OK"')) AssertEqual 4, len(filter(getline(1, line('$')), 'v:val =~ "OK"'))
q q
Execute (Change tag of goyo.vim):
call plug#begin()
Plug 'junegunn/goyo.vim'
call plug#end()
Execute (PlugStatus):
call PlugStatusSorted()
Expect:
Invalid branch/tag: 1.5.3 (expected: master). Try PlugUpdate.
Finished. 1 error(s).
[=]
x goyo.vim:
Execute (PlugUpdate to set the right branch):
PlugUpdate
call PlugStatusSorted()
AssertEqual 2, g:vimrc_reloaded
Expect:
- goyo.vim: OK
Finished. 0 error(s).
[=]
Execute (Change branch of seoul256.vim): Execute (Change branch of seoul256.vim):
call plug#begin() call plug#begin()
Plug 'junegunn/seoul256.vim' Plug 'junegunn/seoul256.vim'
Plug 'git@github.com:junegunn/vim-emoji.git' Plug 'https://bitbucket.org/junegunn/vim-emoji.git'
call plug#end() call plug#end()
Execute (PlugStatus): Execute (PlugStatus):
PlugStatus call PlugStatusSorted()
%y
q
normal! P
%sort
g/^$/d
Expect: Expect:
Invalid branch: no-t_co. Try PlugUpdate. Invalid branch/tag: no-t_co (expected: master). Try PlugUpdate.
- vim-emoji: OK - vim-emoji: OK
Finished. 1 error(s). Finished. 1 error(s).
[==] [==]
@@ -143,16 +179,11 @@ Expect:
Execute (Change URI of seoul256.vim): Execute (Change URI of seoul256.vim):
call plug#begin() call plug#begin()
Plug 'junegunn.choi/seoul256.vim' Plug 'junegunn.choi/seoul256.vim'
Plug 'git@github.com:junegunn/vim-emoji.git' Plug 'https://bitbucket.org/junegunn/vim-emoji.git'
call plug#end() call plug#end()
Execute (PlugStatus): Execute (PlugStatus):
PlugStatus call PlugStatusSorted()
%y
q
normal! P
%sort
g/^$/d
Expect: Expect:
Expected: https://git:@github.com/junegunn.choi/seoul256.vim.git Expected: https://git:@github.com/junegunn.choi/seoul256.vim.git
@@ -172,6 +203,8 @@ Expect:
Execute (PlugClean! to remove seoul256.vim): Execute (PlugClean! to remove seoul256.vim):
PlugClean! PlugClean!
" Three removed, emoji left
AssertEqual 3, len(filter(getline(1, line('$')), 'v:val =~ "^- "'))
AssertEqual 1, len(filter(getline(1, line('$')), 'v:val =~ "Removed"')) AssertEqual 1, len(filter(getline(1, line('$')), 'v:val =~ "Removed"'))
Assert empty(globpath(&rtp, 'colors/seoul256.vim')) Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
Assert !empty(globpath(&rtp, 'autoload/emoji.vim')) Assert !empty(globpath(&rtp, 'autoload/emoji.vim'))
@@ -184,16 +217,11 @@ Execute (Change GIT URI of vim-emoji):
call plug#end() call plug#end()
Execute (PlugStatus): Execute (PlugStatus):
PlugStatus call PlugStatusSorted()
%y
q
normal! P
%sort
g/^$/d
Expect: Expect:
Expected: https://git:@github.com/junegunn/vim-emoji.git Expected: https://git:@github.com/junegunn/vim-emoji.git
Invalid URI: git@github.com:junegunn/vim-emoji.git Invalid URI: https://bitbucket.org/junegunn/vim-emoji.git
Not found. Try PlugInstall. Not found. Try PlugInstall.
PlugClean required. PlugClean required.
Finished. 2 error(s). Finished. 2 error(s).
@@ -203,6 +231,7 @@ Expect:
Execute (PlugClean! to remove vim-emoji): Execute (PlugClean! to remove vim-emoji):
PlugClean! PlugClean!
AssertEqual 1, len(filter(getline(1, line('$')), 'v:val =~ "^- "'))
AssertEqual 1, len(filter(getline(1, line('$')), 'v:val =~ "Removed"')) AssertEqual 1, len(filter(getline(1, line('$')), 'v:val =~ "Removed"'))
Assert empty(globpath(&rtp, 'colors/seoul256.vim')) Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
Assert empty(globpath(&rtp, 'autoload/emoji.vim')) Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
@@ -210,8 +239,8 @@ Execute (PlugClean! to remove vim-emoji):
Execute (PlugUpdate to install both again): Execute (PlugUpdate to install both again):
PlugUpdate PlugUpdate
AssertEqual 2, len(filter(getline(1, line('$')), 'v:val =~ "Cloning into"')) AssertEqual 2, len(filter(getline(1, line('$')), 'v:val =~ "^- [^:]*:"'))
AssertEqual 2, g:vimrc_reloaded AssertEqual 3, g:vimrc_reloaded
Assert !empty(globpath(&rtp, 'colors/seoul256.vim')), 'seoul256.vim should be found' Assert !empty(globpath(&rtp, 'colors/seoul256.vim')), 'seoul256.vim should be found'
Assert !empty(globpath(&rtp, 'autoload/emoji.vim')), 'vim-emoji should be found' Assert !empty(globpath(&rtp, 'autoload/emoji.vim')), 'vim-emoji should be found'
q q
@@ -219,7 +248,7 @@ Execute (PlugUpdate to install both again):
Execute (PlugUpdate only to find out plugins are up-to-date, D key to check): Execute (PlugUpdate only to find out plugins are up-to-date, D key to check):
PlugUpdate PlugUpdate
AssertEqual 2, len(filter(getline(1, line('$')), 'v:val =~ "Already up-to-date"')) AssertEqual 2, len(filter(getline(1, line('$')), 'v:val =~ "Already up-to-date"'))
AssertEqual 3, g:vimrc_reloaded AssertEqual 4, g:vimrc_reloaded
normal D normal D
AssertEqual 'No updates.', getline(1) AssertEqual 'No updates.', getline(1)
q q
@@ -296,6 +325,65 @@ Execute (Plug window in a new tab):
q q
q q
**********************************************************************
~ On-demand loading / Partial installation/update ~
**********************************************************************
Execute (Trying to execute on-demand commands when plugin is not installed):
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'on': ['EasyAlign', 'LiveEasyAlign'] }
call plug#end()
Assert exists(':EasyAlign')
Assert exists(':LiveEasyAlign')
AssertThrows EasyAlign
AssertThrows LiveEasyAlign
Assert !exists(':EasyAlign')
Assert !exists(':LiveEasyAlign')
Execute (New set of plugins):
call plug#begin()
Plug 'junegunn/vim-fnr' " Depends on vim-pseudocl
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
Plug 'junegunn/vim-redis', { 'for': 'redis' }
call plug#end()
Execute (Check commands):
Assert !exists(':FNR'), 'FNR command should not be found'
Assert !exists(':RedisExecute'), 'RedisExecute command should not be found'
Execute (Partial PlugInstall):
PlugInstall vim-fnr vim-easy-align
PlugInstall vim-fnr vim-easy-align 1
q
Execute (Check dependent plugin):
Assert &rtp =~ 'pseudocl', &rtp
Given (Unaligned code):
a=1
aa=2
Execute (Check installed plugins):
Assert exists(':FNR'), 'FNR command should be found'
Assert exists(':EasyAlign'), 'EasyAlign command should be found'
Assert !exists(':RedisExecute'), 'RedisExecute command still should not be found'
%EasyAlign=
Expect (Aligned code):
a = 1
aa = 2
Given (nothing):
Execute (Partial PlugUpdate):
PlugUpdate vim-redis
q
Execute (On-demand loading based on filetypes):
Assert !exists(':RedisExecute'), 'RedisExecute command still should not be found'
set ft=redis
Assert exists(':RedisExecute'), 'RedisExecute command is now found'
Execute (Cleanup): Execute (Cleanup):
call system('rm -rf '.temp_plugged) call system('rm -rf '.temp_plugged)
@@ -303,6 +391,6 @@ Execute (Cleanup):
unlet g:plug_home unlet g:plug_home
unlet g:vimrc_reloaded unlet g:vimrc_reloaded
unlet temp_plugged vader plug basertp save_rtp repo lnum unlet temp_plugged vader plug basertp save_rtp repo lnum
delf PlugStatusSorted
Restore Restore
source $MYVIMRC