Skip to content

Commit

Permalink
tweak direnv detection
Browse files Browse the repository at this point in the history
  • Loading branch information
viperML committed Aug 14, 2024
1 parent 058b159 commit 5b59cfe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
local M = {}

M.check = function()
vim.health.start("External programs")

if vim.fn.executable("direnv") == 1 then
vim.health.ok("direnv found")
else
vim.health.error("direnv not found")
end
end

return M
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ setup_all()
-- end
-- })
local function direnv()
vim.notify("Loading direnv... ")
vim.notify("Loading direnv")

vim.api.nvim_clear_autocmds { group = "lspconfig" }
pcall(function()
Expand All @@ -65,13 +65,15 @@ local function direnv()
vim.schedule(function()
vim.fn.execute(obj.stdout)
setup_all()
vim.notify("Direnv loaded!")
vim.notify("Finished loading direnv")
end)
end)
end

vim.api.nvim_create_user_command("Direnv", direnv, {})

vim.api.nvim_create_autocmd({ "SessionLoadPost" }, {
callback = direnv,
})
if vim.fn.executable("direnv") == 1 then
vim.api.nvim_create_autocmd({ "SessionLoadPost" }, {
callback = direnv,
})
end

0 comments on commit 5b59cfe

Please sign in to comment.