Skip to content

feature: load plugin when root pattern detected #1980

Closed as not planned
Closed as not planned
@hoofcushion

Description

@hoofcushion

Did you check the docs?

  • I have read all the lazy.nvim docs

Is your feature request related to a problem? Please describe.

Currently, lazy.nvim uses events, filetypes, commands, and keymaps to load plugins. However, project-specific plugins don't fit well with these existing handlers. For example:

  • Plugins like lewis6991/gitsigns.nvim should load when a .git directory is present
  • zk-org/zk-nvim should load when a .zk directory exists

Describe the solution you'd like

A new handler to detect root pattern when DirChanged or BufRead, and use vim.fs.root(0,patterns).
pesudo code:

lazy.setup({
 {"lewis6991/gitsigns.nvim",                    rootpattern={".git"}},
})

Describe alternatives you've considered

pass

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions