Skip to content

Commit f61f4e6

Browse files
committed
handle missing v:vim_did_enter / use s:vim_did_enter
1 parent a8c51a5 commit f61f4e6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

plug.vim

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,15 @@ function! plug#end()
298298
if has('syntax') && !exists('g:syntax_on')
299299
syntax enable
300300
end
301+
302+
" NOTE: v:vim_did_enter might not exist with older Vims, and handling it
303+
" manually can be used in tests.
304+
let s:vim_did_enter = 0
305+
augroup PlugLOD
306+
autocmd VimEnter * let s:vim_did_enter = 1
307+
augroup END
301308
else
309+
let s:vim_did_enter = 1
302310
call s:reload_plugins()
303311
endif
304312
endfunction
@@ -522,7 +530,7 @@ function! s:lod_ft(pat, names)
522530

523531
" Executing this is only necessary if "filetype plugin indent on" was used
524532
" before plug#end, and can be skipped when Vim has not entered always.
525-
if v:vim_did_enter
533+
if s:vim_did_enter
526534
if s:need_filetypeplugin_au
527535
call s:doautocmd('filetypeplugin', 'FileType')
528536
endif

0 commit comments

Comments
 (0)