{"id":32657448,"url":"https://github.com/ravsii/nvim-dap-envfile","last_synced_at":"2026-05-15T18:02:56.502Z","repository":{"id":320078940,"uuid":"1080639037","full_name":"ravsii/nvim-dap-envfile","owner":"ravsii","description":"Support for envFile expanding for nvim-dap configurations","archived":false,"fork":false,"pushed_at":"2026-01-10T13:55:02.000Z","size":29,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-11T04:17:17.476Z","etag":null,"topics":["dap","debugging","neovim","neovim-configuration","neovim-plugin","neovim-plugin-lua"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ravsii.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-21T16:46:25.000Z","updated_at":"2026-01-10T13:54:45.000Z","dependencies_parsed_at":"2025-10-21T21:24:40.390Z","dependency_job_id":"34afe4c2-4a80-43e7-8b10-4e0220026196","html_url":"https://github.com/ravsii/nvim-dap-envfile","commit_stats":null,"previous_names":["ravsii/nvim-dap-envfile"],"tags_count":3,"template":false,"template_full_name":"ellisonleao/nvim-plugin-template","purl":"pkg:github/ravsii/nvim-dap-envfile","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ravsii%2Fnvim-dap-envfile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ravsii%2Fnvim-dap-envfile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ravsii%2Fnvim-dap-envfile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ravsii%2Fnvim-dap-envfile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ravsii","download_url":"https://codeload.github.com/ravsii/nvim-dap-envfile/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ravsii%2Fnvim-dap-envfile/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33074395,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dap","debugging","neovim","neovim-configuration","neovim-plugin","neovim-plugin-lua"],"created_at":"2025-10-31T12:01:27.007Z","updated_at":"2026-05-15T18:02:56.491Z","avatar_url":"https://github.com/ravsii.png","language":"Lua","funding_links":[],"categories":["Debugging"],"sub_categories":["CSV Files"],"readme":"# nvim-dap-envfile\n\nA lightweight helper for\n[**nvim-dap**](https://github.com/mfussenegger/nvim-dap) that automatically\nloads `.env` files into your DAP configuration - with support for VSCode -\nstyle variable expansion like `${workspaceFolder}`, and `${env:HOME}`.\n\nHandling of the `envFile` field is, apparently, VS Code-specific. nvim-dap\n[doesn't support it by default](https://github.com/mfussenegger/nvim-dap/discussions/548),\nso this plugin provides that functionality. It’s simple but removes the need to\nrepeat the same code across multiple projects.\n\n## 📦 Installation\n\n### Requirements\n\n- Neovim \u003e= `10.4`\n- [nvim-dap](https://github.com/mfussenegger/nvim-dap)\n\n### Using [lazy.nvim](https://github.com/folke/lazy.nvim)\n\n```lua\n{\n  \"ravsii/nvim-dap-envfile\",\n  version = \"*\", -- use latest stable release\n  dependencies = { \"mfussenegger/nvim-dap\" },\n  opts = {},\n}\n```\n\n## ⚙️ Configuration\n\nDefault configuration, for reference:\n\n```lua\n---@class Config\nlocal default_config = {\n  ---Automatically adds a dap on_config listener.\n  ---@type boolean?\n  add_dap_listener = true,\n  ---Also sets environment variables using the Neovim API. Only works if\n  ---`add_dap_listener` is enabled. This is enabled by default since it adds no\n  ---overhead and can be helpful for certain DAP servers that don’t support the\n  ---`env` option.\n  ---@type boolean?\n  use_neovim_env = true,\n  ---Print additional debug messages. Useful to check what your inputs are\n  ---evaluating to.\n  ---@type boolean?\n  debug = false,\n}\n```\n\nYou can disable adding dap listener on startup, if you want to handle it\nmanually.\n\n## 🧩 Examples\n\n### Using `envFile`\n\nBelow is an example for Go, using your project-local `.nvim.lua` or any other\nper-project configuration file. If you’re unfamiliar with such setups, see\n`:help exrc`.\n\n```lua\nlocal dap = require(\"dap\")\n\ntable.insert(dap.configurations.go, {\n  name = \"some project\",\n  type = \"go\",\n  request = \"launch\",\n  timeout = 10000,\n  outputMode = \"remote\",\n  program = \"main.go\",\n\n  -- will be read, parsed, and passed as \"env\" table.\n  envFile = \"${workspaceFolder}/.env\",\n})\n```\n\n### Using manual parsing\n\n```lua\nlocal dap = require(\"dap\")\nlocal envfile = require(\"nvim-dap-envfile\")\n\ntable.insert(dap.configurations.go, {\n  name = \"some project\",\n  type = \"go\",\n  request = \"launch\",\n  program = \"main.go\",\n  env = envfile.load_env_file(\"${workspaceFolder}/.env\"),\n})\n```\n\n## 🔧 API Reference\n\nIn case you don't want to use built-in dap listener (or you want to build a\ncustom one), you can still use our helper functions\n\n```lua\nlocal envfile = require(\"nvim-dap-envfile\")\n```\n\n### `envfile.expand_path_vars(str: string) -\u003e string`\n\nExpands VS Code–style variables inside a string. For available variables see\nbelow.\n\n```lua\nlocal resolved = envfile.expand_path_vars(\"${workspaceFolder}/.env\")\n-- e.g. \"/home/user/project/.env\"\n```\n\n### `envfile.load_env_file(path: string) -\u003e table`\n\nParses a `.env` file and returns a Lua table of key/value pairs. Path is\nevaluated using `expand_path_vars`.\n\n```lua\nlocal env = envfile.load_env_file(\"${workspaceFolder}/.env\")\nvim.print(env)\n-- { DB_HOST = \"localhost\", PORT = \"8080\" }\n```\n\nQuotes around values (`\"foo\"` or `'foo'`) are stripped automatically.\n\n### `envfile.set_neovim_env(envs: table\u003cstring, string\u003e) -\u003e nil`\n\nSets environment variables for the current Neovim session using the Neovim API\n(`vim.env`). Each key/value pair in `envs` is added to `vim.env`, making the\nvariables available to shell commands, plugins, and other Lua code executed\nwithin Neovim.\n\n```lua\nenvfile.set_neovim_env({\n  DB_HOST = \"localhost\",\n  PORT = \"8080\",\n})\n-- vim.env.DB_HOST == \"localhost\"\n-- vim.env.PORT == \"8080\"\n```\n\n### Variable Expansion\n\n| Variable                     | Example Result               |\n| ---------------------------- | ---------------------------- |\n| `${file}`                    | `/home/user/project/main.go` |\n| `${fileBasename}`            | `main.go`                    |\n| `${fileBasenameNoExtension}` | `main`                       |\n| `${fileDirname}`             | `/home/user/project`         |\n| `${fileExtname}`             | `go`                         |\n| `${relativeFile}`            | `main.go`                    |\n| `${relativeFileDirname}`     | `.`                          |\n| `${workspaceFolder}`         | `/home/user/project`         |\n| `${workspaceFolderBasename}` | `project`                    |\n| `${env:HOME}`                | `/home/user`                 |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fravsii%2Fnvim-dap-envfile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fravsii%2Fnvim-dap-envfile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fravsii%2Fnvim-dap-envfile/lists"}