From 3f34f083db0694032477c8fa6a1ca85c52d59bec Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Tue, 29 Jul 2025 16:06:40 +0300 Subject: [PATCH] fix(pack): ignore 'loadplugins' when sourcing 'after/plugin' scripts Problem: Sourcing of 'after/plugin' scripts depends on the value of 'loadplugins' option. It is redundant, as it has effect only during startup, while it is combined with `vim.v.vim_did_enter == 1` (i.e. "it is after starting up") condition. Solution: Ignore it. --- runtime/lua/vim/pack.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/runtime/lua/vim/pack.lua b/runtime/lua/vim/pack.lua index 0a0635b6e0..879be4b97d 100644 --- a/runtime/lua/vim/pack.lua +++ b/runtime/lua/vim/pack.lua @@ -626,8 +626,7 @@ local function pack_add(plug, load) -- automatically), as `:packadd` only sources plain 'plugin/' files. -- See https://github.com/vim/vim/issues/15584 -- Deliberately do so after executing all currently known 'plugin/' files. - local should_load_after_dir = vim.v.vim_did_enter == 1 and load and vim.o.loadplugins - if should_load_after_dir then + if vim.v.vim_did_enter == 1 and load then local after_paths = vim.fn.glob(plug.path .. '/after/plugin/**/*.{vim,lua}', false, true) --- @param path string vim.tbl_map(function(path)