mirror of
https://github.com/neovim/neovim.git
synced 2026-02-18 17:38:32 +00:00
fix(pack): update add() to have default load=false during startup
Problem: the `load=true` in `vim.pack.add()` means that `:packadd` is executed even during startup. This leads to force source of 'plugin/', which breaks the intended loading order (`:h load-plugins`) and results into sourcing them twice. This also makes it ignore `--noplugin` argument. Using `:packadd!` during startup is more appropriate, while `:packadd` afterwards is still more favorable to actually force 'plugin/' source (as there is no pre-defined mechanism that will load them later). Solution: have `load=false` default during startup, `true` - afterwards.
This commit is contained in:
@@ -669,7 +669,9 @@ end
|
||||
|
||||
--- @class vim.pack.keyset.add
|
||||
--- @inlinedoc
|
||||
--- @field load? boolean Load `plugin/` files and `ftdetect/` scripts. If `false`, works like `:packadd!`. Default `true`.
|
||||
--- Load `plugin/` files and `ftdetect/` scripts. If `false`, works like `:packadd!`.
|
||||
--- Default `false` during startup and `true` afterwards.
|
||||
--- @field load? boolean
|
||||
|
||||
--- Add plugin to current session
|
||||
---
|
||||
@@ -693,7 +695,7 @@ end
|
||||
--- @param opts? vim.pack.keyset.add
|
||||
function M.add(specs, opts)
|
||||
vim.validate('specs', specs, vim.islist, false, 'list')
|
||||
opts = vim.tbl_extend('force', { load = true }, opts or {})
|
||||
opts = vim.tbl_extend('force', { load = vim.v.vim_did_enter == 1 }, opts or {})
|
||||
vim.validate('opts', opts, 'table')
|
||||
|
||||
--- @type vim.pack.Plug[]
|
||||
|
||||
Reference in New Issue
Block a user