Ignore useless use of 'for' option

Close #785
This commit is contained in:
Junegunn Choi 2018-09-11 10:49:27 +09:00
parent 8ed2617ba0
commit f222674a86
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -193,6 +193,11 @@ function! s:ask_no_interrupt(...)
endtry endtry
endfunction endfunction
function! s:has_for(plug)
return has_key(a:plug, 'for') &&
\ (empty(s:to_a(a:plug.for)) || len(s:glob(s:rtp(a:plug), 'plugin')))
endfunction
function! plug#end() function! plug#end()
if !exists('g:plugs') if !exists('g:plugs')
return s:err('Call plug#begin() first') return s:err('Call plug#begin() first')
@ -214,7 +219,7 @@ function! plug#end()
continue continue
endif endif
let plug = g:plugs[name] let plug = g:plugs[name]
if get(s:loaded, name, 0) || !has_key(plug, 'on') && !has_key(plug, 'for') if get(s:loaded, name, 0) || !has_key(plug, 'on') && !s:has_for(plug)
let s:loaded[name] = 1 let s:loaded[name] = 1
continue continue
endif endif