Merge branch 'hori-ryota-feature/fixed-bug-of-on-demand-loading'
Close #236
This commit is contained in:
		
						commit
						099057da65
					
				
							
								
								
									
										2
									
								
								plug.vim
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								plug.vim
									
									
									
									
									
								
							|  | @ -440,7 +440,7 @@ function! s:add(repo, ...) | ||||||
|       call add(g:plugs_order, name) |       call add(g:plugs_order, name) | ||||||
|     endif |     endif | ||||||
|     let g:plugs[name] = spec |     let g:plugs[name] = spec | ||||||
|     let s:loaded[name] = 0 |     let s:loaded[name] = get(s:loaded, name, 0) | ||||||
|   catch |   catch | ||||||
|     return s:err(v:exception) |     return s:err(v:exception) | ||||||
|   endtry |   endtry | ||||||
|  |  | ||||||
|  | @ -34,6 +34,7 @@ Execute (#130 Proper cleanup of on-demand loading triggers): | ||||||
|   augroup END |   augroup END | ||||||
| 
 | 
 | ||||||
|   " Cleared on command |   " Cleared on command | ||||||
|  |   call ReloadPlug() | ||||||
|   call plug#begin('$TMPDIR/plugged') |   call plug#begin('$TMPDIR/plugged') | ||||||
|   Plug 'junegunn/vim-emoji', { 'on':  ['EmojiCommand', 'EmojiCommand2', '<Plug>(EmojiMapping)'] } |   Plug 'junegunn/vim-emoji', { 'on':  ['EmojiCommand', 'EmojiCommand2', '<Plug>(EmojiMapping)'] } | ||||||
|   call plug#end() |   call plug#end() | ||||||
|  | @ -50,6 +51,7 @@ Execute (#130 Proper cleanup of on-demand loading triggers): | ||||||
|   Assert empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) defined' |   Assert empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) defined' | ||||||
| 
 | 
 | ||||||
|   " Cleared on FileType |   " Cleared on FileType | ||||||
|  |   call ReloadPlug() | ||||||
|   call plug#begin('$TMPDIR/plugged') |   call plug#begin('$TMPDIR/plugged') | ||||||
|   Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommandExtra', '<Plug>(EmojiMappingExtra)'], 'for': ['emoji'] } |   Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommandExtra', '<Plug>(EmojiMappingExtra)'], 'for': ['emoji'] } | ||||||
|   call plug#end() |   call plug#end() | ||||||
|  | @ -189,6 +191,7 @@ Execute (#145: Merging on-demand loading triggers - cmd): | ||||||
| Execute (#145: Merging on-demand loading triggers - map): | Execute (#145: Merging on-demand loading triggers - map): | ||||||
|   unlet! g:xxx g:yyy |   unlet! g:xxx g:yyy | ||||||
| 
 | 
 | ||||||
|  |   call ReloadPlug() | ||||||
|   call plug#begin() |   call plug#begin() | ||||||
|   Plug '$PLUG_FIXTURES/xxx', { 'on': '<Plug>(xxx)' } |   Plug '$PLUG_FIXTURES/xxx', { 'on': '<Plug>(xxx)' } | ||||||
|   Plug '$PLUG_FIXTURES/yyy', { 'on': ['<Plug>(xxx)' ,'<Plug>(yyy)' ] } |   Plug '$PLUG_FIXTURES/yyy', { 'on': ['<Plug>(xxx)' ,'<Plug>(yyy)' ] } | ||||||
|  | @ -241,3 +244,26 @@ Execute (#184: Duplicate entries in &rtp): | ||||||
|   Log &rtp |   Log &rtp | ||||||
|   AssertEqual 3, len(filter(split(&rtp, ','), 'stridx(v:val, "plugged") >= 0')) |   AssertEqual 3, len(filter(split(&rtp, ','), 'stridx(v:val, "plugged") >= 0')) | ||||||
| 
 | 
 | ||||||
|  | ********************************************************************** | ||||||
|  | Execute (#236: Plugin removed from &rtp when .vimrc is reloaded): | ||||||
|  |   unlet! g:loaded_easy_align_plugin | ||||||
|  |   silent! delc EasyAlign | ||||||
|  | 
 | ||||||
|  |   call ReloadPlug() | ||||||
|  |   call plug#begin('$TMPDIR/plugged') | ||||||
|  |   Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' } | ||||||
|  |   call plug#end() | ||||||
|  |   PlugInstall | q | ||||||
|  | 
 | ||||||
|  |   Assert &rtp !~ '/vim-easy-align', 'Plugin should not be in &rtp' | ||||||
|  |   %EasyAlign= | ||||||
|  |   Assert &rtp =~ '/vim-easy-align', 'Plugin should be in &rtp' | ||||||
|  | 
 | ||||||
|  |   call plug#begin('$TMPDIR/plugged') | ||||||
|  |   Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' } | ||||||
|  |   call plug#end() | ||||||
|  | 
 | ||||||
|  |   redir => out | ||||||
|  |   silent command EasyAlign | ||||||
|  |   redir END | ||||||
|  |   Assert &rtp =~ '/vim-easy-align', 'Plugin should still be in &rtp' | ||||||
|  |  | ||||||
|  | @ -39,6 +39,19 @@ Execute (Initialize test environment): | ||||||
|     endif |     endif | ||||||
|   endfunction |   endfunction | ||||||
| 
 | 
 | ||||||
|  |   " Reload vim-plug to reset s:-variables | ||||||
|  |   function! ReloadPlug() | ||||||
|  |     let tmp = tempname() | ||||||
|  |     try | ||||||
|  |       call writefile(readfile(globpath(&rtp, 'autoload/plug.vim')), tmp) | ||||||
|  |       unlet g:loaded_plug | ||||||
|  |       execute 'source' tmp | ||||||
|  |       let &rtp = g:basertp | ||||||
|  |     finally | ||||||
|  |       call delete(tmp) | ||||||
|  |     endtry | ||||||
|  |   endfunction | ||||||
|  | 
 | ||||||
| Execute (Print Interpreter Version): | Execute (Print Interpreter Version): | ||||||
|   redir => out |   redir => out | ||||||
|   if has('ruby') |   if has('ruby') | ||||||
|  | @ -66,6 +79,7 @@ Execute (Cleanup): | ||||||
|   silent! delf AssertExpect |   silent! delf AssertExpect | ||||||
|   silent! delf PlugUpdated |   silent! delf PlugUpdated | ||||||
|   silent! delf EnsureLoaded |   silent! delf EnsureLoaded | ||||||
|  |   silent! delf ReloadPlug | ||||||
|   silent! delc AssertExpect |   silent! delc AssertExpect | ||||||
|   silent! unmap / |   silent! unmap / | ||||||
|   silent! unmap ? |   silent! unmap ? | ||||||
|  |  | ||||||
|  | @ -354,6 +354,7 @@ Execute (Reuse Plug window in another tab): | ||||||
| ********************************************************************** | ********************************************************************** | ||||||
| 
 | 
 | ||||||
| Execute (Trying to execute on-demand commands when plugin is not installed): | Execute (Trying to execute on-demand commands when plugin is not installed): | ||||||
|  |   call ReloadPlug() | ||||||
|   call plug#begin() |   call plug#begin() | ||||||
|   Plug 'junegunn/vim-easy-align', { 'on': ['EasyAlign', 'LiveEasyAlign'] } |   Plug 'junegunn/vim-easy-align', { 'on': ['EasyAlign', 'LiveEasyAlign'] } | ||||||
|   call plug#end() |   call plug#end() | ||||||
|  | @ -366,6 +367,7 @@ Execute (Trying to execute on-demand commands when plugin is not installed): | ||||||
|   Assert !exists(':LiveEasyAlign') |   Assert !exists(':LiveEasyAlign') | ||||||
| 
 | 
 | ||||||
| Execute (New set of plugins): | Execute (New set of plugins): | ||||||
|  |   call ReloadPlug() | ||||||
|   call plug#begin() |   call plug#begin() | ||||||
|   Plug 'junegunn/vim-fnr' |   Plug 'junegunn/vim-fnr' | ||||||
|   Plug 'junegunn/vim-pseudocl' |   Plug 'junegunn/vim-pseudocl' | ||||||
|  | @ -778,6 +780,7 @@ Before (Clear global vars): | ||||||
|   set rtp-=$PLUG_FIXTURES/xxx/after |   set rtp-=$PLUG_FIXTURES/xxx/after | ||||||
| 
 | 
 | ||||||
| Execute (Immediate loading): | Execute (Immediate loading): | ||||||
|  |   call ReloadPlug() | ||||||
|   call plug#begin() |   call plug#begin() | ||||||
|   Plug '$PLUG_FIXTURES/xxx' |   Plug '$PLUG_FIXTURES/xxx' | ||||||
|   call plug#end() |   call plug#end() | ||||||
|  | @ -792,6 +795,7 @@ Execute (Immediate loading): | ||||||
|   endif |   endif | ||||||
| 
 | 
 | ||||||
| Execute (Command-based on-demand loading): | Execute (Command-based on-demand loading): | ||||||
|  |   call ReloadPlug() | ||||||
|   call plug#begin() |   call plug#begin() | ||||||
|   Plug '$PLUG_FIXTURES/xxx', { 'on': 'XXX' } |   Plug '$PLUG_FIXTURES/xxx', { 'on': 'XXX' } | ||||||
|   call plug#end() |   call plug#end() | ||||||
|  | @ -805,6 +809,7 @@ Execute (Command-based on-demand loading): | ||||||
|   AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/ftplugin', 'xxx/after/ftplugin', 'xxx/indent', 'xxx/after/indent', 'xxx/syntax', 'xxx/after/syntax'], g:xxx |   AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/ftplugin', 'xxx/after/ftplugin', 'xxx/indent', 'xxx/after/indent', 'xxx/syntax', 'xxx/after/syntax'], g:xxx | ||||||
| 
 | 
 | ||||||
| Execute (Filetype-based on-demand loading): | Execute (Filetype-based on-demand loading): | ||||||
|  |   call ReloadPlug() | ||||||
|   call plug#begin() |   call plug#begin() | ||||||
|   Plug '$PLUG_FIXTURES/xxx', { 'for': 'xxx' } |   Plug '$PLUG_FIXTURES/xxx', { 'for': 'xxx' } | ||||||
|   call plug#end() |   call plug#end() | ||||||
|  | @ -1006,6 +1011,7 @@ Execute (Plug directory with comma): | ||||||
| ********************************************************************** | ********************************************************************** | ||||||
| Execute (Strict load order): | Execute (Strict load order): | ||||||
|   let g:total_order = [] |   let g:total_order = [] | ||||||
|  |   call ReloadPlug() | ||||||
|   call plug#begin() |   call plug#begin() | ||||||
|   Plug '$PLUG_FIXTURES/xxx' |   Plug '$PLUG_FIXTURES/xxx' | ||||||
|   Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] } |   Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] } | ||||||
|  | @ -1019,6 +1025,7 @@ Execute (Strict load order): | ||||||
|   let len = len(split(&rtp, ',')) |   let len = len(split(&rtp, ',')) | ||||||
| 
 | 
 | ||||||
|   let g:total_order = [] |   let g:total_order = [] | ||||||
|  |   call ReloadPlug() | ||||||
|   call plug#begin() |   call plug#begin() | ||||||
|   Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] } |   Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] } | ||||||
|   Plug '$PLUG_FIXTURES/yyy' |   Plug '$PLUG_FIXTURES/yyy' | ||||||
|  | @ -1036,6 +1043,9 @@ Execute (Strict load order): | ||||||
|   AssertEqual len + 2, len(split(&rtp, ',')) |   AssertEqual len + 2, len(split(&rtp, ',')) | ||||||
| 
 | 
 | ||||||
|   let g:total_order = [] |   let g:total_order = [] | ||||||
|  |   call ReloadPlug() | ||||||
|  |   set rtp^=manually-prepended | ||||||
|  |   set rtp+=manually-appended | ||||||
|   call plug#begin() |   call plug#begin() | ||||||
|   Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] } |   Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] } | ||||||
|   Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] } |   Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user