aboutsummaryrefslogtreecommitdiff
path: root/lua/setup/plugins.lua
blob: 0fb088605f9fa7704962ebb24b30f54f6fdd6d59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
-- plugins.lua

-- Helper to compare current Neovim version
local function version_at_least(minor, major)
  local v = vim.version()
  major = major or 0
  return v.major > major or (v.major == major and v.minor >= minor)
end

local function version_below(minor, major)
  local v = vim.version()
  major = major or 0
  return v.major < major or (v.major == major and v.minor < minor)
end

-- Normalize version input: number -> {0, number}, table -> itself
local function parse_version(ver)
  if type(ver) == "number" then return 0, ver end
  if type(ver) == "table" then return ver[1] or 0, ver[2] or 0 end
  return 0, 0
end

-- Determine if plugin should be loaded based on version
local function should_load_plugin(min_version, max_version)
  local min_major, min_minor = parse_version(min_version)
  local max_major, max_minor = parse_version(max_version)

  local ok_min = not min_version or version_at_least(min_minor, min_major)
  local ok_max = not max_version or version_below(max_minor, max_major)

  return ok_min and ok_max
end

-- Helper to check if a table contains a specific value
local function contains(table, val)
  for _, v in ipairs(table) do
    if v == val then
      return true
    end
  end
  return false
end

-- The master list of plugins with all potential options.
-- Keys like 'lazy', 'event', 'keys', 'dependencies' are for Lazy.nvim.
-- Keys like 'config', 'run', 'build' are for all managers.
local universal_plugins = {
  -- Core
  { "nvim-lua/plenary.nvim",   lazy = true },
  { "lewis6991/impatient.nvim" },

  {
    "nvim-treesitter/nvim-treesitter",
    min_version = 9,
    event = "BufReadPre",
  },
  { "nvim-treesitter/nvim-treesitter-textobjects", dependencies = { "nvim-treesitter/nvim-treesitter" } },
  { "nvim-treesitter/playground",                  cmd = "TSPlaygroundToggle" },

  -- LSP
  { "nvimtools/none-ls.nvim",                      event = "BufReadPre" },
  { "neovim/nvim-lspconfig",                       min_version = { 0, 9 },                              event = "BufReadPre" },
  {
    "mason-org/mason.nvim",
    min_version = 10,
    cmd = "Mason",
    event = "BufReadPre",
  },
  { "mason-org/mason-lspconfig.nvim", dependencies = { "mason-org/mason.nvim" } },
  {
    "whoissethdaniel/mason-tool-installer.nvim",
    dependencies = { "mason-org/mason.nvim" },
    event = "BufReadPre",
  },
  {
    "https://git.sr.ht/~whynothugo/lsp_lines.nvim",
    name = 'lsp_lines.nvim',
    config = function()
      require("lsp_lines").setup()
      vim.diagnostic.config({
        virtual_text = false,
      })
    end,
    event = "LspAttach",
  },
  { "rmagatti/goto-preview",          event = "LspAttach" },

  -- Linters/Formatters
  { "mhartington/formatter.nvim",     event = "BufReadPre" },
  {
    "jay-babu/mason-null-ls.nvim",
    event = "BufReadPre",
  },

  -- Completion
  { "hrsh7th/nvim-cmp",                    event = "InsertEnter",                 exclude = { "builtin" } },
  { "hrsh7th/cmp-nvim-lsp",                dependencies = { "hrsh7th/nvim-cmp" }, exclude = { "builtin" } },
  { "hrsh7th/cmp-buffer",                  dependencies = { "hrsh7th/nvim-cmp" }, exclude = { "builtin" } },
  { "hrsh7th/cmp-path",                    dependencies = { "hrsh7th/nvim-cmp" }, exclude = { "builtin" } },
  { "hrsh7th/cmp-cmdline",                 dependencies = { "hrsh7th/nvim-cmp" }, exclude = { "builtin" } },
  { "petertriho/cmp-git",                  dependencies = { "hrsh7th/nvim-cmp" }, exclude = { "builtin" } },
  { "tamago324/cmp-zsh",                   dependencies = { "hrsh7th/nvim-cmp" }, exclude = { "builtin" } },
  { "f3fora/cmp-spell",                    dependencies = { "hrsh7th/nvim-cmp" }, exclude = { "builtin" } },
  { "hrsh7th/cmp-calc",                    dependencies = { "hrsh7th/nvim-cmp" }, exclude = { "builtin" } },
  { "saadparwaiz1/cmp_luasnip",            dependencies = { "hrsh7th/nvim-cmp" }, exclude = { "builtin" } },
  { "hrsh7th/cmp-nvim-lsp-signature-help", dependencies = { "hrsh7th/nvim-cmp" }, exclude = { "builtin" } },
  { "rcarriga/cmp-dap",                    dependencies = { "hrsh7th/nvim-cmp" }, exclude = { "builtin" } },
  { "micangl/cmp-vimtex",                  dependencies = { "hrsh7th/nvim-cmp" }, exclude = { "builtin" } },

  -- Snippets
  { "L3MON4D3/LuaSnip",                    event = "InsertEnter" },
  { "rafamadriz/friendly-snippets",        dependencies = { "L3MON4D3/LuaSnip" } },

  -- Git
  { "tpope/vim-fugitive",              cmd = { "G", "Git", "Gdiffsplit" }, event = "VeryLazy" },
  { "kdheepak/lazygit.nvim",               cmd = "LazyGit",                       keys = "<leader>gg" },
  { "lewis6991/gitsigns.nvim", min_version = 11, dependencies = { "nvim-lua/plenary.nvim" }, event = "BufReadPre" },

  -- UI/UX & Enhancements
  { "rcarriga/nvim-notify",                lazy = false },
  {
    "nvim-tree/nvim-tree.lua",
    --cmd = { "NvimTreeToggle", "NvimTreeFocus", "NvimTreeFindFile" },
    --keys = { "<C-n>", "<leader>e" },
    lazy = false,
    dependencies = { "nvim-tree/nvim-web-devicons"},
    config = function()
      require("plugins.nvim-tree").setup()
    end,
  },
  { "ThePrimeagen/harpoon", keys = { "<leader>h" } },
  { "airblade/vim-rooter",  event = "BufEnter" },
  { "ibhagwan/fzf-lua",     cmd = "FzfLua" },

  --- **Telescope** ---
  {
    "nvim-telescope/telescope.nvim",
    dependencies = { "nvim-lua/plenary.nvim" },
    config = function()
      require("plugins.telescope").setup()
    end,
  },
  {
    "nvim-telescope/telescope-fzf-native.nvim",
    build = "make",
    cond = function()
      return vim.fn.executable("make") == 1
    end,
    dependencies = { "nvim-telescope/telescope.nvim" },
  },
  { "nvim-telescope/telescope-live-grep-args.nvim", dependencies = { "nvim-telescope/telescope.nvim" } },
  { "nvim-telescope/telescope-ui-select.nvim",      dependencies = { "nvim-telescope/telescope.nvim" } },
  { "nvim-telescope/telescope-project.nvim",        dependencies = { "nvim-telescope/telescope.nvim" } },
  { "nvim-telescope/telescope-media-files.nvim",    dependencies = { "nvim-telescope/telescope.nvim" } },
  { "nvim-telescope/telescope-file-browser.nvim",   dependencies = { "nvim-telescope/telescope.nvim" } },
  { "nvim-telescope/telescope-symbols.nvim",        dependencies = { "nvim-telescope/telescope.nvim" } },
  { "nvim-telescope/telescope-dap.nvim",            dependencies = { "nvim-telescope/telescope.nvim" } },
  { "axkirillov/telescope-changed-files",           dependencies = { "nvim-telescope/telescope.nvim" } },
  { "smartpde/telescope-recent-files",              dependencies = { "nvim-telescope/telescope.nvim" } },
  --- End Telescope ---

  -- Neovim UX
  { "folke/neodev.nvim",                            ft = "lua" },
  {
    "numToStr/Navigator.nvim",
    lazy = false,
    config = function()
      require("Navigator").setup()
    end,
  },
  { "tpope/vim-eunuch",       cmd = { "Rename", "Delete", "Mkdir" } },
  { "tpope/vim-unimpaired",   lazy = true,                          event = "VeryLazy" },
  { "kylechui/nvim-surround", event = "VeryLazy" },
  {
    "mbbill/undotree",
    cmd = "UndotreeToggle",
    keys = "<leader>u",
    event = "BufReadPre"
  },
  {
    "myusuf3/numbers.vim",
    event = "BufReadPost",
    config = function()
      vim.cmd("let g:numbers_exclude = ['dashboard']")
    end,
  },
  { "windwp/nvim-autopairs",        event = "InsertEnter" },
  { "numToStr/Comment.nvim",        keys = { "gc", "gb" },             event = "VeryLazy" },
  { "akinsho/toggleterm.nvim",      cmd = { "ToggleTerm", "TermExec" } },
  { "tweekmonster/startuptime.vim", cmd = "StartupTime" },
  { "qpkorr/vim-bufkill",           cmd = { "BD", "BUN" } },
  {
    "ggandor/leap.nvim",
    keys = { "s", "S" },
    event = "VeryLazy",
    config = function()
      require("leap").add_default_mappings()
    end,
  },
  {
    "ggandor/flit.nvim",
    keys = { "f", "F", "t", "T" },
    event = "VeryLazy",
    config = function()
      require("flit").setup()
    end,
  },
  {
    "folke/which-key.nvim",
    min_version = { 0, 10 },
    event = "VeryLazy",
    --keys = "<leader>",
    config = function()
      require("which-key").setup()
    end,
  },
  { "folke/zen-mode.nvim",              cmd = "ZenMode" },
  { "romainl/vim-cool",                 event = "VeryLazy" },
  { "antoinemadec/FixCursorHold.nvim",  lazy = true },
  { "folke/trouble.nvim",               cmd = { "Trouble", "TroubleToggle" } },

  -- Colorschemes & Visuals (load immediately)
  { "nyoom-engineering/oxocarbon.nvim", lazy = false,                                    priority = 1000 },
  { "bluz71/vim-nightfly-guicolors",    lazy = false,                                    priority = 1000 },
  { "ayu-theme/ayu-vim",                lazy = false,                                    priority = 1000 },
  { "joshdick/onedark.vim",             lazy = false,                                    priority = 1000 },
  { "NTBBloodbath/doom-one.nvim",       lazy = false,                                    priority = 1000 },
  { "nyngwang/nvimgelion",              lazy = false,                                    priority = 1000 },
  { "projekt0n/github-nvim-theme",      lazy = false,                                    priority = 1000 },
  { "folke/tokyonight.nvim",            lazy = false,                                    priority = 1000 },
  { "ribru17/bamboo.nvim",              lazy = false,                                    priority = 1000 },

  -- UI Enhancements
  --{ "kyazdani42/nvim-web-devicons",     lazy = true },
  { "nvim-tree/nvim-web-devicons",     lazy = true },
  { "onsails/lspkind-nvim",             dependencies = { "hrsh7th/nvim-cmp" },           exclude = { "builtin" } },
  { "kevinhwang91/nvim-ufo",            dependencies = { "kevinhwang91/promise-async" }, event = "BufReadPre" },
  {
    "luukvbaal/statuscol.nvim",
    event = "WinNew",
    config = function()
      local builtin = require("statuscol.builtin")
      require("statuscol").setup({
        relculright = true,
        segments = {
          { text = { builtin.foldfunc },      click = "v:lua.ScFa" },
          { text = { "%s" },                  click = "v:lua.ScSa" },
          { text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" },
        },
      })
    end,
  },
  { "lukas-reineke/indent-blankline.nvim", event = "BufReadPre" },
  {
    "glepnir/dashboard-nvim",
    dependencies = { "nvim-tree/nvim-web-devicons" },
    cmd = "Dashboard",
  },
  { "karb94/neoscroll.nvim",               event = "BufReadPre" },
  { "MunifTanjim/prettier.nvim",           event = "BufWritePre" },
  {
    "norcalli/nvim-colorizer.lua",
    cmd = { "ColorizerToggle", "ColorizerAttachToBuffer" },
    config = function()
      require("colorizer").setup({
        user_default_options = {
          RGB = true,
          RRGGBB = true,
          names = false,
          RRGGBBAA = false,
          css = false,
          css_fn = true,
          mode = "foreground",
        },
      })
    end,
  },
  { "MunifTanjim/nui.nvim" },
  { "metakirby5/codi.vim", cmd = "Codi" },
  {
    "kosayoda/nvim-lightbulb",
    dependencies = { "antoinemadec/FixCursorHold.nvim" },
    event = "LspAttach",
  },
  { "SmiteshP/nvim-navic",      event = "LspAttach" },
  {
    "rebelot/heirline.nvim",
    event = "VeryLazy",
    dependencies = {
      "nvim-tree/nvim-web-devicons", -- For file icons
      "lewis6991/gitsigns.nvim",     -- For git status
    },
    config = function()
      -- Ensure gitsigns is loaded before Heirline
      if package.loaded["gitsigns"] == nil then
        require("gitsigns").setup()
      end
      local ok, heirline = pcall(require, "plugins.heirline")
      if ok and heirline then
        heirline.setup()
      else
        vim.notify("Failed to load Heirline configuration", vim.log.levels.ERROR)
      end
    end,
    init = function()
      -- Set up the statusline to use Heirline once it's loaded
      vim.opt.statusline = "%{%v:lua.require'heirline'.eval_statusline()%}"
      vim.opt.winbar = "%{%v:lua.require'heirline'.eval_winbar()%}"
      vim.opt.tabline = "%{%v:lua.require'heirline'.eval_tabline()%}"
    end,
  },
  {
    "samodostal/image.nvim",
    config = function()
      require("image").setup({})
    end,
    ft = { "markdown" },
  },

  -- Language Specific
  { "simrat39/rust-tools.nvim", ft = "rust" },
  {
    "saecki/crates.nvim",
    dependencies = { "nvim-lua/plenary.nvim" },
    config = function()
      require("crates").setup()
    end,
    ft = "rust",
  },
  {
    "akinsho/flutter-tools.nvim",
    dependencies = {
      "nvim-lua/plenary.nvim",
      "stevearc/dressing.nvim",
    },
    config = function()
      require("flutter-tools").setup({
        debugger = {
          enabled = true,
          run_via_dap = true,
        },
      })
    end,
    ft = "dart",
  },
  {
    "iamcco/markdown-preview.nvim",
    build = "cd app && npm install",
    ft = "markdown",
    config = function()
      vim.g.mkdp_filetypes = { "markdown" }
      vim.cmd("let g:mkdp_auto_close = 0")
    end,
    cmd = "MarkdownPreview",
  },
  {
    "ellisonleao/glow.nvim",
    config = function()
      local glow_path = vim.fn.executable("~/.local/bin/glow") == 1 and "~/.local/bin/glow" or "/usr/bin/glow"
      require("glow").setup({
        style = "dark",
        glow_path = glow_path,
      })
    end,
    ft = "markdown",
  },

  -- Debugging
  { "mfussenegger/nvim-dap",           event = "VeryLazy" },
  { "rcarriga/nvim-dap-ui",            dependencies = { "mfussenegger/nvim-dap" }, cmd = "DapUI" },
  { "theHamsta/nvim-dap-virtual-text", dependencies = { "mfussenegger/nvim-dap" } },
  { "gabrielpoca/replacer.nvim",       cmd = "Replacer" },
  { "jayp0521/mason-nvim-dap.nvim",    dependencies = { "mason-org/mason.nvim" } },

  -- Misc
  { "rmagatti/auto-session",           event = "VimEnter" },
  { "tpope/vim-sleuth",                lazy = true },
  { "michaelb/sniprun",                build = "bash ./install.sh",                cmd = "SnipRun" },
  { "stevearc/overseer.nvim",          cmd = "Overseer" },
  {
    "nvim-neotest/neotest",
    dependencies = {
      "nvim-neotest/neotest-python",
      "nvim-neotest/neotest-plenary",
      "nvim-neotest/neotest-vim-test",
      "nvim-neotest/nvim-nio",
    },
    cmd = "Neotest",
  },
  { "kawre/leetcode.nvim",   cmd = "Leetcode" },
  { "m4xshen/hardtime.nvim", lazy = true },

  -- LaTeX
  { "lervag/vimtex",         ft = "tex" },
}

-- Helper function to detect current manager
local function detect_current_manager()
  -- Check if we're currently using lazy (by checking if lazy module exists)
  if package.loaded["lazy"] or package.loaded["lazy.core.util"] then
    return "lazy"
  end

  -- Check if we're currently using packer
  if package.loaded["packer"] then
    return "packer"
  end

  -- Check for builtin manager
  if vim.plugins and vim.plugins.spec then
    return "builtin"
  end

  return "unknown"
end

local function format_for_lazy(plugin)
  -- Lazy.nvim's format is the closest to our universal format, so we can
  -- largely just copy the table, with some specific adjustments.
  local new_plugin = vim.deepcopy(plugin)

  -- Lazy.nvim uses `dependencies` key for dependencies, not `requires`
  if new_plugin.requires then
    new_plugin.dependencies = new_plugin.requires
    new_plugin.requires = nil
  end

  -- Change 'as' to 'name' for lazy
  if new_plugin.as then
    new_plugin.name = new_plugin.as
    new_plugin.as = nil
  end

  -- Change 'run' to 'build' for lazy
  if new_plugin.run then
    new_plugin.build = new_plugin.run
    new_plugin.run = nil
  end

  return new_plugin
end

local function format_for_packer(plugin)
  -- For Packer, we need to remove lazy-loading keys to force eager loading
  local new_plugin = vim.deepcopy(plugin)

  -- Convert dependencies back to requires for packer
  if new_plugin.dependencies then
    new_plugin.requires = new_plugin.dependencies
    new_plugin.dependencies = nil
  end

  -- Convert name back to as for packer
  if new_plugin.name then
    new_plugin.as = new_plugin.name
    new_plugin.name = nil
  end

  -- Convert build back to run for packer
  if new_plugin.build then
    new_plugin.run = new_plugin.build
    new_plugin.build = nil
  end

  -- Remove lazy-loading keys to force eager loading in packer
  new_plugin.event = nil
  new_plugin.keys = nil
  new_plugin.cmd = nil
  new_plugin.ft = nil
  new_plugin.lazy = nil

  return new_plugin
end

local function format_for_builtin(plugin)
  -- This function is now simplified, as the main loop handles flattening
  local new_plugin = vim.deepcopy(plugin)

  -- Convert GitHub shorthand to full URL if needed
  if type(new_plugin) == "string" then
    if new_plugin:match("^[%w%-_%.]+/[%w%-_%.]+$") then
      return {
        src = "https://github.com/" .. new_plugin,
        name = new_plugin:match("/([%w%-_%.]+)$")
      }
    else
      return { src = new_plugin }
    end
  end

  -- Handle table format
  if new_plugin[1] and type(new_plugin[1]) == "string" then
    local repo = new_plugin[1]
    if repo:match("^[%w%-_%.]+/[%w%-_%.]+$") then
      new_plugin.src = "https://github.com/" .. repo
      new_plugin.name = new_plugin.name or new_plugin.as or repo:match("/([%w%-_%.]+)$")
    else
      new_plugin.src = repo
    end
    new_plugin[1] = nil -- Remove positional argument
  end

  -- Convert url to src if present
  if new_plugin.url then
    new_plugin.src = new_plugin.url
    new_plugin.url = nil
  end

  -- Convert 'as' to 'name'
  if new_plugin.as then
    new_plugin.name = new_plugin.as
    new_plugin.as = nil
  end

  -- Only keep the keys that vim.pack uses: src, name, and version
  new_plugin.dependencies = nil
  new_plugin.config = nil
  new_plugin.build = nil
  new_plugin.run = nil
  new_plugin.cond = nil
  new_plugin.min_version = nil
  new_plugin.max_version = nil
  new_plugin.lazy = nil
  new_plugin.priority = nil
  new_plugin.event = nil
  new_plugin.keys = nil
  new_plugin.cmd = nil
  new_plugin.ft = nil
  new_plugin.requires = nil

  return new_plugin
end

-- Detect which manager is currently active and format plugins accordingly
local current_manager = detect_current_manager()
local plugins_to_process = {}
local processed_plugins = {} -- Use a set to avoid duplicates

-- Flatten the plugin list for the builtin manager
if current_manager == "builtin" then
  local function get_plugin_name(plugin)
    if type(plugin) == "string" then
      return plugin:match("/([%w%-_%.]+)$") or plugin
    elseif type(plugin) == "table" then
      -- Get name from 'name', 'as', or from the src/url
      return plugin.name or plugin.as or (type(plugin[1]) == "string" and plugin[1]:match("/([%w%-_%.]+)$")) or
          plugin.url:match("/([%w%-_%.]+)$")
    end
  end

  local function add_to_process(plugin)
    local name = get_plugin_name(plugin)
    if name and not processed_plugins[name] then
      table.insert(plugins_to_process, plugin)
      processed_plugins[name] = true
    end
  end

  for _, plugin in ipairs(universal_plugins) do
    add_to_process(plugin)
    if plugin.dependencies then
      for _, dep in ipairs(plugin.dependencies) do
        add_to_process(dep)
      end
    end
    if plugin.requires then
      for _, req in ipairs(plugin.requires) do
        add_to_process(req)
      end
    end
  end
else
  plugins_to_process = universal_plugins
end

local finalized_plugins = {}

for _, plugin in ipairs(plugins_to_process) do
  local cond_ok = true

  -- Check for the new 'exclude' option first
  if plugin.exclude and contains(plugin.exclude, current_manager) then
    cond_ok = false
  end

  if cond_ok and (plugin.min_version or plugin.max_version) then
    cond_ok = should_load_plugin(plugin.min_version, plugin.max_version)
  end
  if cond_ok and plugin.cond then
    cond_ok = plugin.cond()
  end

  if cond_ok then
    local new_plugin
    if current_manager == "lazy" then
      new_plugin = format_for_lazy(plugin)
    elseif current_manager == "packer" then
      new_plugin = format_for_packer(plugin)
    elseif current_manager == "builtin" then
      new_plugin = format_for_builtin(plugin)
    else
      -- Default to lazy format if manager is unknown
      new_plugin = format_for_lazy(plugin)
    end
    table.insert(finalized_plugins, new_plugin)
  end
end

return finalized_plugins