Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: on conditional disable, do not import additional plugin modules #1079

Merged
merged 1 commit into from
Oct 6, 2023
Merged

feat: on conditional disable, do not import additional plugin modules #1079

merged 1 commit into from
Oct 6, 2023

Conversation

abeldekat
Copy link
Contributor

@abeldekat abeldekat commented Oct 6, 2023

Example:

{
    {
      "folke/tokyonight.nvim",
      lazy = true,
      opts = { style = "moon" },
    },

    {
      "LazyVim/LazyVim",
      priority = 10000,
      lazy = false,
      opts = {
        colorscheme = "tokyonight",
      },
      version = "*",
      import = "lazyvim.plugins",
      -- cond = false,
      enabled = false,
    },
}

In this scenario, the LazyVim plugin is disabled, and the modules in lazyvim.plugins are not loaded.
However, when using cond = false, the modules in lazyvim.plugins are loaded, disregarding the cond setting.

For the lazyflex plugin, it makes sense to enable/disable the plugin using cond.
In issue Simpify installation instructions the motivation for this PR is described.

This PR adds a check on cond to lazy.core.plugin, method Spec:import(spec).

I tested the changes using my lazy starter fork, see config.lazy.

@abeldekat abeldekat changed the title feat: when a plugin is disabled conditionally, do not import its additional plugin modules feat: on conditional disable, do not import additional plugin modules Oct 6, 2023
@folke folke merged commit 58e954a into folke:main Oct 6, 2023
3 checks passed
@folke
Copy link
Owner

folke commented Oct 6, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants