Skip to content

Feature Request: Support for Custom Environment File Patterns #6

Description

@ph1losof

Problem

Currently, cmp-dotenv appears to support .env* files through regex matching, but it would be beneficial to have more explicit support for custom environment file naming conventions that don't follow the standard .env* pattern.

Requested Feature

Add configuration options to explicitly specify custom environment file patterns beyond the default .env* files. This would include support for:

  • .envrc (used by direnv)
  • env.prod, env.dev, env.staging
  • Custom user-defined environment file names
  • Project-specific environment file conventions

Use Cases

Many projects use different environment file naming conventions:

  • direnv users: Often use .envrc files
  • Production deployments: May use env.prod, env.production
  • Custom workflows: Teams may have their own naming conventions

Suggested Implementation

Consider adding a configuration option like:

require('cmp').setup({
  sources = {
    {
      name = 'dotenv',
      option = {
        path = '.',
        custom_patterns = { '.envrc', 'env.*', 'environment.*' },
        -- or
        file_patterns = { '.env*', '.envrc', 'env.{prod,dev,staging}' }
      }
    }
  }
})

Alternative Solution

For users who need custom environment file patterns support immediately, ecolog.nvim provides a nearly drop-in replacement for cmp-dotenv which additionally includes context awareness via provider-patterns feature and solves #3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions