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.
This commit is contained in:
Evgeni Chasnovski
2025-07-29 16:06:40 +03:00
parent 28e2a5c151
commit 3f34f083db

View File

@@ -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)