From 179fa7bb82e645f035b59f55cde2ef628e63283a Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 20 May 2015 00:24:15 +0900 Subject: [PATCH] Check if autocmd defined before doautocmd This removes `No matching autocommands` message --- plug.vim | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plug.vim b/plug.vim index 30ab8ff..cbe7e58 100644 --- a/plug.vim +++ b/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)