From 7e5aae5e1187842cb0b1d8def986e48d481c4410 Mon Sep 17 00:00:00 2001 From: mattn Date: Thu, 15 Oct 2026 04:36:11 +0000 Subject: [PATCH] Skip BufRead for an unnamed empty buffer (#1341) Loading a plugin on demand triggers BufRead to apply ftdetect and ftplugin files, but there is nothing to detect in an unnamed empty buffer such as the one Vim creates on startup. Signed-off-by: Yasuhiro Matsumoto --- plug.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plug.vim b/plug.vim index 0605bab..58a894e 100644 --- a/plug.vim +++ b/plug.vim @@ -570,6 +570,10 @@ function! s:doautocmd(...) endfunction function! s:dobufread(names) + " Nothing to detect in an unnamed empty buffer, e.g. the one on startup + if empty(bufname('%')) && line('$') == 1 && empty(getline(1)) + return + endif for name in a:names let path = s:rtp(g:plugs[name]) for dir in ['ftdetect', 'ftplugin', 'after/ftdetect', 'after/ftplugin']