mirror of
https://github.com/junegunn/vim-plug.git
synced 2025-12-07 01:24:27 +08:00
Check if autocmd defined before doautocmd
This removes `No matching autocommands` message
This commit is contained in:
12
plug.vim
12
plug.vim
@@ -356,7 +356,9 @@ function! plug#load(...)
|
||||
for name in a:000
|
||||
call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
||||
endfor
|
||||
doautocmd BufRead
|
||||
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
|
||||
doautocmd filetypeplugin FileType
|
||||
doautocmd filetypeindent FileType
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user