Skip to content
This repository was archived by the owner on Dec 7, 2025. It is now read-only.

Commit 02023b5

Browse files
committed
update
1 parent 2080c32 commit 02023b5

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

lua/strive/init.lua

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ local OPT_DIR = vim.fs.joinpath(data_dir, 'site', 'pack', 'strive', 'opt')
1818

1919
-- Add to packpath
2020
vim.opt.packpath:prepend(vim.fs.joinpath(data_dir, 'site'))
21-
vim.g.strim_loaded = 0
21+
vim.g.strive_loaded = 0
22+
vim.g.strive_count = 0
2223

2324
local DEFAULT_SETTINGS = {
2425
max_concurrent_tasks = if_nil(vim.g.strive_max_concurrent_tasks, 10),
@@ -652,7 +653,7 @@ function Plugin:load()
652653
-- Prevent recursive loading
653654
-- Set loaded to true before actual loading to prevent infinite loops
654655
self.loaded = true
655-
vim.g.strim_loaded = vim.g.strim_loaded + 1
656+
vim.g.strive_loaded = vim.g.strive_loaded + 1
656657

657658
load_opts(self.init_opts)
658659

@@ -804,6 +805,17 @@ function Plugin:cmd(commands)
804805
return self
805806
end
806807

808+
function Plugin:cond(condition)
809+
self.is_lazy = true
810+
if
811+
(type(condition) == 'string' and api.nvim_eval(condition))
812+
or (type(condition) == 'function' and condition())
813+
then
814+
self:load()
815+
end
816+
return self
817+
end
818+
807819
-- Set up lazy loading for specific keymaps
808820
function Plugin:keys(mappings)
809821
self.is_lazy = true
@@ -1214,6 +1226,7 @@ function M.use(spec)
12141226
-- Add to collections
12151227
table.insert(plugins, plugin)
12161228
plugin_map[plugin.name] = plugin
1229+
vim.g.strive_count = vim.g.strive_count + 1
12171230

12181231
return plugin
12191232
end

0 commit comments

Comments
 (0)