Lua implementation of direnv.vim for automatic .envrc handling & syntax.
Find a file
NotAShelf 66ebab06d0
direnv.nvim: complete plugin overhaul
I should have worked more with atomic commits and less with whatever the
hell this is supposed to be, but hindsight is 20/20. tl;dr is that this
refactor improves the plugin with better UX, slightly better
performance, and better compatibility with Neovim 0.10, which I have
overlooked last time. Changes are, from memory, as follows:

- Caching system to prevent excessive direnv status checks
- Statusline integration to show direnv status in real-time
- Proper async handling for all operations
- Added (subpar) .envrc file editor with creation prompt
- Added autocmd hooks for other plugins (User `DirenvLoaded`, fixes #5)
- Better, comprehensive notification system with proper scheduling
- Intuitive handling of allowed/pending/blocked states
- Added command to check direnv status
- Improved contextual commands and keyboard mappings (despite "best"
  practices)

For those who have direnv.nvim already set up (despite the repo being
archived for months), I tried to retain full backwards compat. New
functionality and error fixes were built on top.
2025-03-19 13:37:37 +03:00
.github/workflows ci: check style & lint Lua code 2024-07-03 21:03:40 +03:00
lua direnv.nvim: complete plugin overhaul 2025-03-19 13:37:37 +03:00
.gitignore Initial commit 2024-07-03 14:49:58 +00:00
.luacheckrc ci: check style & lint Lua code 2024-07-03 21:03:40 +03:00
LICENSE Initial commit 2024-07-03 14:49:58 +00:00
README.md initial commit 2024-07-03 17:50:43 +03:00
stylua.toml initial commit 2024-07-03 17:50:43 +03:00

direnv.nvim

Dead simple Neovim plugin to add automatic Direnv loading, inspired by direnv.vim and written in Lua.

📦 Installation

Install direnv.nvim with your favorite plugin manager, or clone it manually. You will need to call the setup function to load the plugin.

🚀 Usage

direnv.nvim will automatically call direnv allow in your current directory if direnv is available in your PATH, and you have auto-loading enabled.

🔧 Configuration

You can pass your config table into the setup() function or opts if you use lazy.nvim.

Options

  • bin (optional, type: string): the path to the Direnv binary. May be an absolute path, or just direnv if it's available in your PATH. - Default: direnv
  • autoload_direnv (optional, type: boolean): whether to call direnv allow when you enter a directory that contains an .envrc. - Default: false
  • keybindings (optional, type: table of strings): the table of keybindings to use.
    • Default: {allow = "<Leader>da", deny = "<Leader>dd", reload = "<Leader>dr"}

Example:

require("direnv").setup({
   autoload_direnv = true,
})