dotenv.nvim
dotenv.nvim copied to clipboard
Please expose `load` as a public function
Hello!
Thanks for this plugin! I primarily use this to load some secrets for Github integration into Neovim.
However, can you please expose the load
function to the end users? I need to load a .env
file that's outside the cwd (and parents) and I had to dig into the source to find a Lua solution (using Lazy package manager):
return {
{
'ellisonleao/dotenv.nvim',
opts = {
enable_on_load = true,
},
config = function(_, opts)
require('dotenv').setup(opts)
local dotfiles = vim.uv.fs_realpath(vim.fn.expand('~/.config/nvim/init.lua'))
assert(dotfiles, 'Could not find dotfiles')
require('dotenv').command({fargs = {
vim.fs.dirname(dotfiles) .. '/../.env',
}})
end,
},
}
The last command could be simplified if I could just access load
directly:
require('dotenv').load(vim.fs.dirname(dotfiles) .. '/../.env')
Thanks!!