Check if autocmd defined before doautocmd

This removes `No matching autocommands` message
This commit is contained in:
Junegunn Choi 2015-05-20 00:24:15 +09:00
parent 76bce26ab8
commit 179fa7bb82

View File

@ -356,7 +356,9 @@ function! plug#load(...)
for name in a:000
call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
endfor
if exists('#BufRead')
doautocmd BufRead
endif
return 1
endfunction
@ -392,8 +394,12 @@ endfunction
function! s:lod_ft(pat, names)
call s:lod(a:names, ['plugin', 'after/plugin'])
execute 'autocmd! PlugLOD FileType' a:pat
if exists('#filetypeplugin#FileType')
doautocmd filetypeplugin FileType
endif
if exists('#filetypeindent#FileType')
doautocmd filetypeindent FileType
endif
endfunction
function! s:lod_cmd(cmd, bang, l1, l2, args, names)